Jump to content


This topic is now archived and is closed to further replies.


asign a variable to an array value

Recommended Posts

i have the following array

$fruits = array("cherry" => "red", "apple" => "red", "kiwi" => "green", "strawberry" => "red", "pear" => "yellow", "melon" => "green",

"grapes" => "green", "watermelon" => "red", "banana" => "yellow")


using the array_count_values($fruits) i get

Array ( => 4 => 3 [yellow] => 2 )


how can i asign the value of each key to a variable?

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.