Menu
I’m looping through a JSON file. I’m looping through this and creating my own array and updating items in my array.
For example imagine I have the follow
TV (2)
Washing Machine (33)
Fridge (23)
TV (2)
Car (4)
TV (2)
As I loop though I’m getting the object ID, 2 for the TV. I’m doing this by saying
`if (in_array($json[“ID”], $myArray”){
As my array is empty I’m inserting a new row
`$myArray[] = array(‘Object’ => $json[“ID”], ‘Count’ => 1);
My question is when I get to the next TV and my in_array returns true. How can I get this specific item and update the count by one??