Jump to content

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?

Link to comment
Share on other sites


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

  • Create New...

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.