3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array( array( "id" => "1", "values" => array( "1", "2" ) ), array( "id" => "2", "values" => array( "1", "3" ) ), array( "id" => "3", "values" => array( "2", "4" ) ), array( "id" => "4", "values" => array( "4", "6" ) ), ); $value = '2'; $result = array_filter($a, function (array $element) use ($value) { return array_key_exists('values', $element) && is_array($element['values']) && in_array($value, $element['values'], true); }); var_dump($result);
Output for git.master, git.master_jit, rfc.property-hooks
array(2) { [0]=> array(2) { ["id"]=> string(1) "1" ["values"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "2" } } [2]=> array(2) { ["id"]=> string(1) "3" ["values"]=> array(2) { [0]=> string(1) "2" [1]=> string(1) "4" } } }

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:
28.24 ms | 406 KiB | 5 Q