3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ids_arr = [213, 154]; $fruits_arr = [ ["id" => 213, "fruit" => "banana"], ["id" => 438, "fruit" => "apple"], ["id" => 154, "fruit" => "peach"] ]; $ids_arr = array_flip($ids_arr); $selected_fruits = []; foreach ($fruits_arr as $k => $fruit) { if (isset($ids_arr[$fruit["id"]])) { $selected_fruits[$k] = $fruit; } } print_r($selected_fruits);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [0] => Array ( [id] => 213 [fruit] => banana ) [2] => Array ( [id] => 154 [fruit] => peach ) )

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