<?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>Traversing the Associative Array Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/traversing-the-associative-array/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/traversing-the-associative-array/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Thu, 05 Aug 2021 12:54:01 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Complete Tutorial of Associative Arrays</title>
		<link>https://www.scmgalaxy.com/tutorials/complete-tutorial-of-associative-arrays/</link>
					<comments>https://www.scmgalaxy.com/tutorials/complete-tutorial-of-associative-arrays/#respond</comments>
		
		<dc:creator><![CDATA[Ashwani Kumar]]></dc:creator>
		<pubDate>Thu, 05 Aug 2021 12:54:00 +0000</pubDate>
				<category><![CDATA[php]]></category>
		<category><![CDATA[array]]></category>
		<category><![CDATA[Array operators]]></category>
		<category><![CDATA[Associative Arrays]]></category>
		<category><![CDATA[Complete Tutorial of Arrays]]></category>
		<category><![CDATA[Creating an associative array]]></category>
		<category><![CDATA[Features of Associative Arrays]]></category>
		<category><![CDATA[Php]]></category>
		<category><![CDATA[Some Features of Associative Arrays]]></category>
		<category><![CDATA[Traversing the Associative Array]]></category>
		<category><![CDATA[Tutorial for Array operators]]></category>
		<category><![CDATA[What]]></category>
		<category><![CDATA[What is Associative Arrays]]></category>
		<guid isPermaLink="false">https://www.scmgalaxy.com/tutorials/?p=7453</guid>

					<description><![CDATA[<p>What is Associative Arrays? Key value pairs are stored in associative arrays. For example, a numerically indexed array might not [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/complete-tutorial-of-associative-arrays/">Complete Tutorial of Associative Arrays</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">What is Associative Arrays?</h2>



<p class="wp-block-paragraph">Key value pairs are stored in associative arrays. For example, a numerically indexed array might not be the ideal choice for storing a student&#8217;s marks from several subjects in an array. Instead, we might use the names of the subjects as the keys in our associative array, with their appropriate marks as the value.</p>



<p class="wp-block-paragraph"><strong>Example:-</strong></p>



<script src="https://gist.github.com/AdarshAshwani/dfae25be6f36c8b7aa40b371990b522c.js"></script>



<p class="wp-block-paragraph"><strong>Output:</strong>&#8211;</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img fetchpriority="high" decoding="async" width="444" height="174" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-39.png" alt="" class="wp-image-7457" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-39.png 444w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-39-300x118.png 300w" sizes="(max-width: 444px) 100vw, 444px" /></figure></div>



<h3 class="wp-block-heading">Some Features of Associative Arrays?</h3>



<p class="wp-block-paragraph">Associative arrays are similar to numeric arrays in appearance, but differ in terms of index. An associative array&#8217;s index is a string that establishes a strong relationship between key and value.</p>



<p class="wp-block-paragraph">For storing employee wages in an array, a numerically indexed array is not the ideal choice. Instead, you may create an associative list with the workers&#8217; names as keys and their salary as the value.</p>



<ul class="wp-block-list"><li>The variable&#8217;s name is &#8220;$variable name…&#8221;, the element&#8217;s access index number is &#8220;[&#8216;key name&#8217;],&#8221; and the array element&#8217;s value is &#8220;value.&#8221;</li><li>Consider the following scenario: you have a group of people and want to assign gender to each of them based on their names.</li><li>You may achieve this by using an associative list.</li><li>You can do so by using the code below.</li></ul>



<h4 class="wp-block-heading"><strong>Traversing the Associative Array</strong>:-</h4>



<p class="wp-block-paragraph">Loops may be used to go over associative arrays. The associative array can be looped through in two different ways. Using the for loop first, and then the foreach loop second.</p>



<p class="wp-block-paragraph"><strong>Example:-</strong></p>



<p class="wp-block-paragraph">In this case, the array keys() function is used to identify indices with provided names, and the count() method is used to count the number of indices in associative arrays.</p>



<script src="https://gist.github.com/AdarshAshwani/587ce0731aeac39c67296144ec7ae2de.js"></script>



<p class="wp-block-paragraph"><strong>Output:-</strong></p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" width="559" height="362" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-40.png" alt="" class="wp-image-7458" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-40.png 559w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-40-300x194.png 300w" sizes="(max-width: 559px) 100vw, 559px" /></figure></div>



<h4 class="wp-block-heading"><strong>Creating an associative array of mixed types</strong>:-</h4>



<script src="https://gist.github.com/AdarshAshwani/a46ba22f51b28c585cb00fac1b8c4dc0.js"></script>



<p class="wp-block-paragraph"><strong>Output:-</strong></p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" width="342" height="111" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-41.png" alt="" class="wp-image-7459" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-41.png 342w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2021/08/image-41-300x97.png 300w" sizes="(max-width: 342px) 100vw, 342px" /></figure></div>



<p class="wp-block-paragraph"></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/complete-tutorial-of-associative-arrays/">Complete Tutorial of Associative Arrays</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/complete-tutorial-of-associative-arrays/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
