3v4l.org

run code in 300+ PHP versions simultaneously
<?php $input = '010069008517306731020020001319100421191004091395'; if (preg_match_all('/(01)(\d{14})|(310[12]|3202|1[135])(\d{6})|(21)(\d+)/', $input, $matches)) { $array = array_filter(array_combine($matches[1], $matches[2]) + array_combine($matches[3], $matches[4]) + array_combine($matches[5], $matches[6])); print_r($array); } else { echo "Invalid input!"; }
Output for 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
Array ( [01] => 00690085173067 [3102] => 002000 [13] => 191004 [21] => 191004091395 )

preferences:
39.82 ms | 850 KiB | 4 Q