Today, We want to share with you php associative array.In this post we will show you php multidimensional associative array, hear for PHP array key value we will give you demo and example for implement.In this post, we will learn about Sort associative array by specific key in PHP with an example.
php associative array
Example 1 : PHP Associative Arrays
"35", "Ben"=>"37", "Jagruti"=>"43"); echo "Virat is " . $members['Virat'] . " years old."; ?>
Example 2 : Loop Through an Associative Array
"35", "Ben"=>"37", "Jagruti"=>"43"); foreach($members as $x => $x_value) { echo "Key=" . $x . ", Value=" . $x_value; echo "
"; } ?>
Example 3
2000, "bhagyashri" => 1000, "dharmishta" => 500); echo "Earning of pihushree is ". $earnings['pihushree'] . "
"; echo "Earning of bhagyashri is ". $earnings['bhagyashri']. "
"; echo "Earning of dharmishta is ". $earnings['dharmishta']. "
"; /* Second method to make an array. */ $earnings['pihushree'] = "high"; $earnings['bhagyashri'] = "medium"; $earnings['dharmishta'] = "low"; echo "Earning of pihushree is ". $earnings['pihushree'] . "
"; echo "Earning of bhagyashri is ". $earnings['bhagyashri']. "
"; echo "Earning of dharmishta is ". $earnings['dharmishta']. "
"; ?>
New Example
PHP Associative Array
I hope you get an idea about php associative array.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.