3v4l.org

run code in 300+ PHP versions simultaneously
<?php function filter($array, $like, $kol) { $filtered = array_filter($array, function ($item) use ($kol, $like) { if (array_key_exists($kol, $item)) { return $item[$kol] === $like; } return false; }); return array_values($filtered); } $array = [ ["a" => "test"], ["b" => "test2"], ["c" => "test"] ]; print_r(filter($array, "test", "b")); print_r(filter($array, "test2", "b"));
Output for git.master_jit, git.master, rfc.property-hooks
Array ( ) Array ( [0] => Array ( [b] => test2 ) )

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:
13.41 ms | 405 KiB | 5 Q