3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '500 - 1112', ' 1113 - 2224', '2225 - 4446 ', '4446' ]; var_export( array_reduce( $array, function ($result, $v) { if (sscanf($v, '%d - %d', $ints[], $ints[]) === 2) { $result[0] ??= []; array_push($result[0], ...$ints); } else { $result[1] = $ints[0]; } return $result; }, [] ) );
Output for git.master_jit, git.master
array ( 0 => array ( 0 => 500, 1 => 1112, 2 => 1113, 3 => 2224, 4 => 2225, 5 => 4446, ), 1 => 4446, )

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:
55.65 ms | 405 KiB | 5 Q