<?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"; }
You have javascript disabled. You will not be able to edit any code.