3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sc = 'hello 8491241 some text 6254841 some text 568241 414844:412'; preg_match_all('/[0-9]{5,10}/', $sc, $matches1); preg_match_all('/[0-9]{5,10}:[0-9]{1,5}/', $sc, $matches2); $my_matches[1] = $matches1[0]; $my_matches[2] = $matches2[0]; $cub[1] = function($match) { return array( 'batch' => $match, 'type' => '1', ); }; $cub[2] = function($match) { return array( 'batch' => $match, 'type' => '2', ); }; $result = call_user_func_array('array_merge', array_map(function($a, $b) { return array_map($a, $b); }, $cub, $my_matches)); var_dump($result);

preferences:
26.26 ms | 402 KiB | 5 Q