I have simple foreach loop in an array
<?php
$colors = array("red", "green", "blue", "yellow");
foreach ($colors as $value) {
echo "$value <br>";
}
?>
I would like to get the occurence number of the value, something like "$value is X occurence <br>"
so the text would be:
red is 0 occurence
green is 1 occurence
....
How can I do that?
"; }` – splash58 Feb 05 '18 at 09:01