Re: String breaking up
| From: | _lallous | Date: | Fri, 26 Oct 2001 14:12:17 +0000 |
| Subject: | Re: String breaking up | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-72445@lists.php.net to get a copy of this message | ||
$string = "hey there!";
$out = '';
for ($i=0; $i<count($string); $i++) {
$out .= strtoupper($string[$i]) . "\n"; // or <br> if output is to
browser
}
echo $out;
"Richard Baskett" <rick@baskettcase.com> wrote in message
news:B7FEAE8C.5216%rick@baskettcase.com...
> Strings are arrays, so you can print out a string by doing something like
> this:
>
> $string = "hey there!";
>
> for ($i=0; $i<count($string); $i++) {
> echo strtoupper($string[$i]);
> }
>
> That's about all there is to it! :) Use the strtoupper() function if you
> mean to have everything uppercase like in your example.
>
> Rick
>
> > I was looking to take a string like Dan and return it like
> > D
> > A
> > N
> >
> > is it the str function that does that
> >
> > =====
> > Dan McCullough
> > -------------------------------------------------------------------
> > "Theres no such thing as a problem unless the servers are on fire!"
> > h: 603.444.9808
> > w: McCullough Family
> > w: At Work
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Make a great connection at Yahoo! Personals.
> > http://personals.yahoo.com
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net
> >
>