3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = "B1A23R4CD"; $chars = str_split($string); $output = [[], []]; foreach ($chars as $char) { $output[ctype_alpha($char)][] = $char; // ^^^^^^^^^^^^^^^^^^- false is 0, true is 1 } var_export($output);

preferences:
29.22 ms | 406 KiB | 5 Q