3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?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);
Output for 5.4.0 - 7.1.0
Notice: Array to string conversion in /in/eInIV on line 11 Notice: Array to string conversion in /in/eInIV on line 11 Notice: Array to string conversion in /in/eInIV on line 11 string(0) "" string(15) "ArrayArrayArray"
Output for 4.3.0 - 5.3.29
string(0) "" string(15) "ArrayArrayArray"