3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = array( json_decode('{"name": "foo1", "other": "test"}'), json_decode('{"name": "foo2", "other": "test"}'), json_decode('{"name": "foo3", "other": "test"}'), ); echo "INPUT\n", str_repeat('=', 20), "\n"; var_dump($input); echo "\n"; echo "RESULT\n", str_repeat('=', 20), "\n"; var_dump( $result = array_filter($input, function($o) use ($name) { return $o->name == $name; }) ); echo "usage\n", str_repeat('=', 20), "\n"; $match = $result[0]; var_dump($match->other);

preferences:
49.76 ms | 402 KiB | 5 Q