$text = ereg_replace('(.)', '\1<br>', $text);
Note the "parenthesized subexpression." The '\1' is replaced by whatever is found by '(.)' in the argument list, then the string replacement is performed. This process repeats until ereg_replace can't find any more characters.