3v4l.org

run code in 300+ PHP versions simultaneously
<?php $cars = [ 0 => ["id" => 1, "name" => "FORD"], 1 => ["id" => 2, "name" => "BMW"], 2 => ["id" => 3, "name" => "FIAT"], 3 => ["id" => 4, "name" => "RENAULT"], 4 => ["id" => 5, "name" => "BENTLEY"], ]; $selection = [ 0 => "1", 1 => "3", 2 => "4" ]; $cars_by_id = array_column($cars, null, 'id'); $selected_cars = array_intersect_key($cars_by_id, array_flip($selection)); var_dump($selected_cars);
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { [1]=> array(2) { ["id"]=> int(1) ["name"]=> string(4) "FORD" } [3]=> array(2) { ["id"]=> int(3) ["name"]=> string(4) "FIAT" } [4]=> array(2) { ["id"]=> int(4) ["name"]=> string(7) "RENAULT" } }

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