How in PHP to check for the presence of multiple arrays in the $ row [] element? For example, there is an array of the following description:

$array = [ 'item1' => 'new, ussr', 'item2' => 'new', 'item' => 'old' ]; 

So, how to get all the elements where the content = 'new, ussr'?

1 answer 1

 $res = []; array_walk($array, function ($v, $k) use (&$res) { if ($v === 'new, ussr'){ $res[$k] = $v; } }); print_r($res);