3v4l.org

run code in 500+ PHP versions simultaneously
<?php $comps = [ [ 'c_id' => '123', 'status' => 'active' ], [ 'c_id' => '456', 'status' => 'destroyed' ], [ 'c_id' => '789', 'status' => 'active' ] ]; $rests = [ [ 'r_id' => 123, 'extra' => 'some extra info for r_id 123' ], [ 'r_id' => 456, 'extra' => 'some extra info for r_id 456' ] ]; $result = []; foreach ($comps as $comp) { if ($comp['status'] !== 'active') { continue; } foreach ($rests as $rest) { if ($rest['r_id'] == $comp['c_id']) { $result[] = $rest; break; } } } var_export($result);
Output for git.master, git.master_jit, rfc.property-hooks
array ( 0 => array ( 'r_id' => 123, 'extra' => 'some extra info for r_id 123', ), )

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:
23.32 ms | 1265 KiB | 4 Q