Home of web learners

www.webn3rd.com

Associative array is used to assign data with text key where indexed array used number to identify

It helps to use text where indexing with text is better to identify and a different type of data in array variable need to use

Lets look an example:

<?php
$colorinfo = array("name"=>"green", "type"=>"basic", "hexcode"=>"#0f0");
echo $color[name]."<br/>";
echo $color[hexcode];
?>

Output:

green

#0f0

Here,we see that we can use text instead of number in inedexed array,so by using text key we can easily work with those assigned data

It is very useful when work with varity type data and better to identify

webn3rd.com

About webn3rd