3v4l.org

run code in 300+ PHP versions simultaneously
<?php $items = [ ["item_a" =>3,"valor_a" =>396], ["item_a" =>3,"valor_a" =>1514], ["item_a" =>3,"valor_a" =>2106], ["item_a" =>6,"valor_a" =>1020], ["item_a" =>4,"valor_a" =>1319], ["item_a" =>11,"valor_a" =>1912] ]; $search = 3; $newArray = array_filter($items, function($item) use($search) { return $item['item_a'] == $search; }); print_r($newArray); $newArray2 = array_map(function($item) use($search) { if ($item['item_a'] == $search) { return $item['valor_a']; } },$items); print_r(array_filter($newArray2));
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [item_a] => 3 [valor_a] => 396 ) [1] => Array ( [item_a] => 3 [valor_a] => 1514 ) [2] => Array ( [item_a] => 3 [valor_a] => 2106 ) ) Array ( [0] => 396 [1] => 1514 [2] => 2106 )

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
27.71 ms | 406 KiB | 5 Q