- var_dump: documentation ( source)
- preg_match_all: documentation ( source)
<?php
$string = "00 a 51 - a9";
$numbers = "";
$chars = "";
preg_match_all("/(\d*)(\D*)/", $string, $matches);
//print_r($matches);
foreach($matches as $match) {
$numbers .= is_int($match) ? $match : '';
$chars .= !is_int($match) ? $match : '';
}
var_dump($numbers);
echo " ";
var_dump($chars);