3v4l.org

run code in 300+ PHP versions simultaneously
<?php function matchStrings($str) { $ret = array(); // $ret = explode("\n", $str); foreach($ret as $asub) { $asub = str_replace('x', '', $asub); preg_match('/^(sh[0-9]+sh)+/', trim($asub), $ret['matches'][]); } $ret = array_unique($ret['matches']); foreach($ret as $sfind) { var_dump($sfind); } return $ret; // } $test = <<<MULTI xx xx sh1sh xx xx xx sh2sh xx xx xx xx sh**sh xx xx x xx xx sh3xxxsh xx xx sh4shsh5sh xxx MULTI; $matches = matchStrings($test); print_r($matches);
Output for git.master, git.master_jit, rfc.property-hooks
Warning: Array to string conversion in /in/UMbhs on line 13 Warning: Array to string conversion in /in/UMbhs on line 13 Warning: Array to string conversion in /in/UMbhs on line 13 Warning: Array to string conversion in /in/UMbhs on line 13 Warning: Array to string conversion in /in/UMbhs on line 13 array(2) { [0]=> string(5) "sh1sh" [1]=> string(5) "sh1sh" } Array ( [0] => Array ( [0] => sh1sh [1] => sh1sh ) )

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:
82.84 ms | 402 KiB | 8 Q