<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>php arrays Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/tag/php-arrays/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/tag/php-arrays/</link>
	<description>Code Solution</description>
	<lastBuildDate>Mon, 02 Aug 2021 23:52:44 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.1.7</generator>

<image>
	<url>https://codeplaners.com/wp-content/uploads/2020/09/cropped-favicon-social-32x32.png</url>
	<title>php arrays Archives - Codeplaners</title>
	<link>https://codeplaners.com/tag/php-arrays/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>PHP String Concatenate Variable and Array Example</title>
		<link>https://codeplaners.com/php-string-concatenate-variable-and-array-example/</link>
					<comments>https://codeplaners.com/php-string-concatenate-variable-and-array-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 02 Aug 2021 23:52:44 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php arrays]]></category>
		<category><![CDATA[Source Code]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1150</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you php string concatenate, variable and array example. This article will give you simple example of php string concatenate, variable and array example. you will learn php string concatenate, variable and array example. Php is provided to the two types of Concatenation (&#8220;.&#8221;),(&#8216;.=&#8217;) to So let’s follow few &#8230; <a href="https://codeplaners.com/php-string-concatenate-variable-and-array-example/" class="more-link">Continue reading<span class="screen-reader-text"> "PHP String Concatenate Variable and Array Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/php-string-concatenate-variable-and-array-example/">PHP String Concatenate Variable and Array Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you php string concatenate, variable and array example. This article will give you simple example of php string concatenate, variable and array example. you will learn php string concatenate, variable and array example. </p>
<p>Php is provided to the two types of Concatenation (&#8220;.&#8221;),(&#8216;.=&#8217;) to </p>
<p>So let’s follow few step to create example of php string concatenate, variable and array example.</p>
<h3>(&#8220;.&#8221;) Operator</h3>
<pre class="brush: xml; title: ; notranslate">
 The dot concatenation operator in PHP concatenate  right and left arguments.
</pre>
<h3>(&#8216;.=&#8217;) Operator</h3>
<pre class="brush: xml; title: ; notranslate">
 This second concatenation operator helps in the expansion of the right side argument to the left side argument.
</pre>
<h3>Concatenate Two Strings &#038; Variables In PHP Example</h3>
<pre class="brush: php; title: ; notranslate">
 &lt;?php
    $string1 = 'John';
    $string2 = 'shina';
    $name_str = $string1 . ' ' . $string2;
    echo $name_str;
?&gt;
</pre>
<h3>Output:</h3>
<pre class="brush: xml; title: ; notranslate">
 John shina
</pre>
<h3>Concatenating Variable With String In PHP Example</h3>
<pre class="brush: php; title: ; notranslate">
 &lt;?php
    $var = &quot;Hello&quot;;
    echo $var.' World';
?&gt;
</pre>
<h3>Output:</h3>
<pre class="brush: xml; title: ; notranslate">
 Hello World
</pre>
<h3>Concatenate Two Arrays In PHP Example</h3>
<pre class="brush: php; title: ; notranslate">
 &lt;?php
    $myArr = array(1, &quot;tv&quot; =&gt; &quot;ac&quot;, 2, &quot;washing machine&quot;, 3);
    $mySecondArr = array(&quot;word&quot;, &quot;abc&quot;, &quot;vegetable&quot; =&gt; &quot;tomato&quot;, &quot;state&quot; =&gt; &quot;washington dc&quot;);

    $output = array_merge($myArr, $mySecondArr);
    print_r($output);
?&gt;
</pre>
<h3>Output:</h3>
<pre class="brush: xml; title: ; notranslate">
Array

(

    &#x5B;0] =&gt; 1

    &#x5B;tv] =&gt; ac

    &#x5B;1] =&gt; 2

    &#x5B;2] =&gt; washing machine

    &#x5B;3] =&gt; 3

    &#x5B;4] =&gt; word

    &#x5B;5] =&gt; abc

    &#x5B;vegetable] =&gt; tomato

    &#x5B;state] =&gt; washington dc

)
</pre>
<p>Now you can check your own.</p>
<p>I hope it can help you&#8230;</p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/php-string-concatenate-variable-and-array-example/">PHP String Concatenate Variable and Array Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/php-string-concatenate-variable-and-array-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Get Previous Array Element from Current Key in Php</title>
		<link>https://codeplaners.com/get-previous-array-element-from-current-key-in-php/</link>
					<comments>https://codeplaners.com/get-previous-array-element-from-current-key-in-php/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Mon, 02 Aug 2021 23:19:02 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php arrays]]></category>
		<category><![CDATA[Source Code]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1147</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you get previous array element from current key in php. This article will give you simple example of get previous array element from current key in php. you will learn get previous array element from current key in php. So let’s follow few step to create example of &#8230; <a href="https://codeplaners.com/get-previous-array-element-from-current-key-in-php/" class="more-link">Continue reading<span class="screen-reader-text"> "Get Previous Array Element from Current Key in Php"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/get-previous-array-element-from-current-key-in-php/">Get Previous Array Element from Current Key in Php</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you get previous array element from current key in php. This article will give you simple example of get previous array element from current key in php. you will learn get previous array element from current key in php. </p>
<p>So let’s follow few step to create example of get previous array element from current key in php.</p>
<h3>Example:</h3>
<pre class="brush: php; title: ; notranslate">
&lt;?php
  
$myArray = &#x5B;&quot;PHP&quot;, &quot;Laravel&quot;, &quot;Angular&quot;, &quot;React&quot;, &quot;Vue&quot;];
   
foreach($myArray as $key =&gt; $value){
	echo &quot;&lt;br/&gt; Current: &quot;. $value;
	echo &quot; | Previous: &quot;. getPrevValue($key, $myArray);
}
  
function getPrevValue($key, $hash = array())
{
    $keys = array_keys($hash);
    $found_index = array_search($key, $keys);
    if ($found_index === false || $found_index === 0)
        return false;
    return $hash&#x5B;$keys&#x5B;$found_index-1]];
}
 
?&gt;
</pre>
<pre class="brush: xml; title: ; notranslate">
  Current: PHP | Previous:
  Current: Laravel | Previous: PHP
  Current: Angular | Previous: Laravel
  Current: React | Previous: Angular
  Current: Vue | Previous: React
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/get-previous-array-element-from-current-key-in-php/">Get Previous Array Element from Current Key in Php</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/get-previous-array-element-from-current-key-in-php/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>PHP Explode All Character into Array Example</title>
		<link>https://codeplaners.com/php-explode-all-character-into-array-example/</link>
					<comments>https://codeplaners.com/php-explode-all-character-into-array-example/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Sat, 31 Jul 2021 08:25:35 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php arrays]]></category>
		<category><![CDATA[Source Code]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=1129</guid>

					<description><![CDATA[<p>Hi Dev, Today, i we will show you PHP explode all character into array example. This article will give you simple example of PHP explode all character into array example. you will learn PHP explode all character into array example. So let’s follow few step to create example of PHP explode all character into array &#8230; <a href="https://codeplaners.com/php-explode-all-character-into-array-example/" class="more-link">Continue reading<span class="screen-reader-text"> "PHP Explode All Character into Array Example"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/php-explode-all-character-into-array-example/">PHP Explode All Character into Array Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Hi Dev,</p>
<p>Today, i we will show you PHP explode all character into array example. This article will give you simple example of PHP explode all character into array example. you will learn PHP explode all character into array example. So let’s follow few step to create example of PHP explode all character into array example.</p>
<h3>Example:</h3>
<pre class="brush: php; title: ; notranslate">
&lt;?php
    $name = &quot;Mohan&quot;;

    $arr = str_split($name);
  
    print_r($arr);
  
?&gt;
</pre>
<h3>Output:</h3>
<pre class="brush: php; title: ; notranslate">
Array
(
    &#x5B;0] =&gt; M
    &#x5B;1] =&gt; o
    &#x5B;2] =&gt; h
    &#x5B;3] =&gt; a
    &#x5B;3] =&gt; n
)
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/php-explode-all-character-into-array-example/">PHP Explode All Character into Array Example</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/php-explode-all-character-into-array-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What Is PHP Arrays</title>
		<link>https://codeplaners.com/what-is-php-arrays/</link>
					<comments>https://codeplaners.com/what-is-php-arrays/#respond</comments>
		
		<dc:creator><![CDATA[admin]]></dc:creator>
		<pubDate>Fri, 05 Mar 2021 06:30:46 +0000</pubDate>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php arrays]]></category>
		<guid isPermaLink="false">https://codeplaners.com/?p=453</guid>

					<description><![CDATA[<p>Arrays in PHP area unit a kind of information structure. that permits us to store multiple components of a similar knowledge sort underneath one variable, which saves us from making an attempt to make a separate variable for every knowledge. In PHP primarily arrays of 3 types: Indexed or Numeric Arrays: AN array with a &#8230; <a href="https://codeplaners.com/what-is-php-arrays/" class="more-link">Continue reading<span class="screen-reader-text"> "What Is PHP Arrays"</span></a></p>
<p>The post <a rel="nofollow" href="https://codeplaners.com/what-is-php-arrays/">What Is PHP Arrays</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Arrays in PHP area unit a kind of information structure. that permits us to store multiple components of a similar knowledge sort underneath one variable, which saves us from making an attempt to make a separate variable for every knowledge.</p>
<p><strong>In PHP primarily arrays of 3 types:</strong></p>
<p><strong>Indexed or Numeric Arrays:</strong> AN array with a numeric index wherever values area unit hold on linearly.</p>
<p><strong>Associative Arrays:</strong> AN array with a string index wherever rather than linear storage, every price will be allotted a selected key.</p>
<p><strong>Multidimensional Arrays:</strong> AN array that contains single or multiple arrays among it and might be accessed via multiple indices.</p>
<h3>Indexed or Numeric Arrays</h3>
<p>These arrays will store numbers, strings and any object however their index are described by numbers. By default array index starts from zero. These arrays is created in 2 alternative ways as shown within the following example:</p>
<pre class="brush: php; title: ; notranslate">
&lt;!doctype html&gt;
&lt;html&gt;
   &lt;body&gt;
   
      &lt;?php
         /* First method to create array. */
         $numbers = array( 1, 2, 3, 4, 5);
         
         foreach( $numbers as $value ) {
            echo &quot;Value is $value &lt;br /&gt;&quot;;
         }
         
         /* Second method to create array. */
         $numbers&#x5B;0] = &quot;one&quot;;
         $numbers&#x5B;1] = &quot;two&quot;;
         $numbers&#x5B;2] = &quot;three&quot;;
         $numbers&#x5B;3] = &quot;four&quot;;
         $numbers&#x5B;4] = &quot;five&quot;;
         
         foreach( $numbers as $value ) {
            echo &quot;Value is $value &lt;br /&gt;&quot;;
         }
      ?&gt;
      
   &lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Result:-</strong></p>
<pre class="brush: php; title: ; notranslate">
Value is 1 
Value is 2 
Value is 3 
Value is 4 
Value is 5 
Value is one 
Value is two 
Value is three 
Value is four 
Value is five 
</pre>
<h3>Associative Arrays</h3>
<p>These sorts of arrays square measure like the indexed arrays however rather than linear storage, each price is allotted with a user-defined key of string sort.</p>
<p><strong>NOTE:−</strong> do not keep associative array within double quote whereas printing otherwise it might not come back any price.</p>
<pre class="brush: php; title: ; notranslate">
&lt;!doctype html&gt;
&lt;html&gt;
   &lt;body&gt;
      
      &lt;?php
         /* First method to associate create array. */
         $salaries = array(&quot;anthony&quot; =&gt; 2000, &quot;ram&quot; =&gt; 1000, &quot;zara&quot; =&gt; 500);
         
         echo &quot;Salary of anthony is &quot;. $salaries&#x5B;'anthony'] . &quot;&lt;br /&gt;&quot;;
         echo &quot;Salary of ram is &quot;.  $salaries&#x5B;'ram']. &quot;&lt;br /&gt;&quot;;
         echo &quot;Salary of zara is &quot;.  $salaries&#x5B;'zara']. &quot;&lt;br /&gt;&quot;;
         
         /* Second method to create array. */
         $salaries&#x5B;'anthony'] = &quot;high&quot;;
         $salaries&#x5B;'ram'] = &quot;medium&quot;;
         $salaries&#x5B;'zara'] = &quot;low&quot;;
         
         echo &quot;Salary of anthony is &quot;. $salaries&#x5B;'anthony'] . &quot;&lt;br /&gt;&quot;;
         echo &quot;Salary of ram is &quot;.  $salaries&#x5B;'ram']. &quot;&lt;br /&gt;&quot;;
         echo &quot;Salary of zara is &quot;.  $salaries&#x5B;'zara']. &quot;&lt;br /&gt;&quot;;
      ?&gt;
   
   &lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Result:-</strong></p>
<pre class="brush: php; title: ; notranslate">
Salary of anthony is 2000
Salary of ram is 1000
Salary of zara is 500
Salary of anthony is high
Salary of ram is medium
Salary of zara is low
</pre>
<h3>Multidimensional Arrays</h3>
<p>Multi-dimensional arrays area unit such arrays that store another array at every index rather than one part. In alternative words, we will outline multi-dimensional arrays as associate array of arrays. because the name suggests, each part during this array will be associate array and that they can even hold alternative sub-arrays at intervals. Arrays or sub-arrays in three-d arrays will be accessed victimization multiple dimensions.<br />
Example:</p>
<pre class="brush: php; title: ; notranslate">
&lt;!doctype html&gt;
&lt;html&gt;
   &lt;body&gt;
      
      &lt;?php 
  
// Add a multidimensional array 
$favorites = array( 
    array( 
        &quot;name&quot; =&gt; &quot;Ram&quot;, 
        &quot;mob&quot; =&gt; &quot;6489715523&quot;, 
        &quot;email&quot; =&gt; &quot;ram@gmail.com&quot;, 
    ), 
    array( 
        &quot;name&quot; =&gt; &quot;Anthony&quot;, 
        &quot;mob&quot; =&gt; &quot;9884358721&quot;, 
        &quot;email&quot; =&gt; &quot;anthony@gmail.com&quot;, 
    ), 
    array( 
        &quot;name&quot; =&gt; &quot;Zara&quot;, 
        &quot;mob&quot; =&gt; &quot;9829601023&quot;, 
        &quot;email&quot; =&gt; &quot;zara@gmail.com&quot;, 
    ) 
); 
  
// Accessing elements 
echo &quot;Ram E-mail is: &quot; . $favorites&#x5B;0]&#x5B;&quot;email&quot;], &quot;\n&quot;; 
echo &quot;Zara mobile number is: &quot; . $favorites&#x5B;2]&#x5B;&quot;mob&quot;]; 
  
?&gt; 
   
   &lt;/body&gt;
&lt;/html&gt;
</pre>
<p><strong>Result:-</strong></p>
<pre class="brush: php; title: ; notranslate">
Ram E-mail is: ram@gmail.com 
Zara mobile number is: 9829601023
</pre>
<p>The post <a rel="nofollow" href="https://codeplaners.com/what-is-php-arrays/">What Is PHP Arrays</a> appeared first on <a rel="nofollow" href="https://codeplaners.com">Codeplaners</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://codeplaners.com/what-is-php-arrays/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
