3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array("station8", "2ndExit", "block9a", "floor5"); echo "<pre>" . __FILE__ . '-->' . __METHOD__ . ':' . __LINE__ . PHP_EOL; var_dump(minMaxNum($arr)); die(); function minMaxNum ($arr = array()) { $min = $max = null; foreach ($arr as $value) { $value = preg_split('/(?<=\d)(?=[a-zA-Z])|(?<=[a-zA-Z])(?=\d)/i', $value); $value = array_filter($value, function ($n){ if(!is_numeric($n)) { unset($n); } else { return $n; } }); foreach($value as $item) { if($min == null && $max == null) { // not initiated $min = $max = $item; } else { if($item < $min) $min = $item; if($item > $max) $max = $item; } } } echo "<pre>" . __FILE__ . '-->' . __METHOD__ . ':' . __LINE__ . PHP_EOL; var_dump($min, $max); die(); }
Output for git.master, git.master_jit, rfc.property-hooks
<pre>/in/Qb6Y7-->:5 <pre>/in/Qb6Y7-->minMaxNum:29 string(1) "2" string(1) "9"

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