note 5586 modified in split by ronabop
| From: | ronabop@php.net | Date: | Fri, 11 Aug 2000 16:06:41 +0000 |
| Subject: | note 5586 modified in split by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-1235@lists.php.net to get a copy of this message | ||
How would you replicate the following Perl code in PHP?
@letters = split('',$var);
---
The answer is simple: you don't have to. PHP allows $string[<character>] access already.
how could i find a new line in a multilined text area and replace it with <br> ?
---
You're using the wrong function. What you want can be accomplished with:
<PRE>str_replace("\n", "<BR>", $your_string)</PRE>
---
-Richard
http://www.php.net/manual/function.split.php