3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array('abc7', 'cbd4', 'def9'); $b = array('r1' => '/abc\d/', 'b2' => '/cbd\d/', 'f5' => '/def\d/'); $result = array(); // Store the result $iloop = 0; // Use to match corresponding element key in $a; $matches = array(); foreach($b AS $key => $preg) { if (preg_match($preg, $a[$iloop++], $matches)) { $result[$key] = $matches[0]; } } print_r($result);
Output for git.master, git.master_jit, rfc.property-hooks
Array ( [r1] => abc7 [b2] => cbd4 [f5] => def9 )

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:
29.2 ms | 401 KiB | 8 Q