This example (with redundant variables to make it clearer) could be a possible solution:
<?php
$str = "php1234";
$pattern = "/([a-z]+|[0-9]+)/i";
$subject = "php3781038";
$flags = PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE;
$stuff = preg_split($pattern, $subject, -1, $flags);
print_r($stuff);
?>