<?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>arrays Archives - Codeplaners</title>
	<atom:link href="https://codeplaners.com/tag/arrays/feed/" rel="self" type="application/rss+xml" />
	<link>https://codeplaners.com/tag/arrays/</link>
	<description>Code Solution</description>
	<lastBuildDate>Fri, 05 Mar 2021 06:33:50 +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>arrays Archives - Codeplaners</title>
	<link>https://codeplaners.com/tag/arrays/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<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>
