RE: [PHP] String breaking up
| From: | Kees Hoekzema | Date: | Fri, 26 Oct 2001 13:14:17 +0000 |
| Subject: | RE: [PHP] String breaking up | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72444@lists.php.net to get a copy of this message | ||
> Strings are arrays, so you can print out a string by doing something like
> this:
Yups, this is possible, but i think he wants to have a newline for each
character,
you can doe this excelent with a small addition to your example:
> $string = "hey there!";
>
> for ($i=0; $i<count($string); $i++) {
> echo strtoupper($string[$i]);
> }
becomes:
$string = "hey there!";
for ($i=0; $i<count($string); $i++) {
echo "$string[$i]\n"; // or "<br>" if you want to use HTML
}
Kees