3v4l.org

run code in 300+ PHP versions simultaneously
<?php $list = [ '10-20', '12-14', '-5-10', '-10--2' ]; foreach ($list as $item) { list($first, $second) = preg_split('/(?<=\d)-/', $item); echo "\$first = $first, \$second = $second\n"; }

preferences:
55.69 ms | 402 KiB | 5 Q