Re: String breaking up

From: Date: Fri, 26 Oct 2001 13:48:08 +0000
Subject: Re: String breaking up
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-72450@lists.php.net to get a copy of this message
<Original message> From: Dan McCullough <McWC@rocketmail.com> Date: Fri, Oct 26, 2001 at 06:03:00AM -0700 Message-ID: <20011026130300.89287.qmail@web11806.mail.yahoo.com> Subject: [PHP] String breaking up > 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 > </Original message> <Reply> Hi Dan, This is what you're looking for: $string = preg_replace ("/(.)/e", "strtoupper('\\1').\"<br>\"", $string); See the example below: ---[ PHP Example ]--- <?php $string = "Dan is great"; $string = preg_replace ("/(.)/e", "strtoupper('\\1').\"<br>\"", $string); print ($string); ?> ---[ End of PHP Example ]--- Or is you don't want the upper case characters after all: $string = preg_replace ("/(.)/", "\\1<br>", $string); Again, see the example below: ---[ PHP Example ]--- <?php $string = "Dan is great"; $string = preg_replace ("/(.)/", "\\1<br>", $string); print ($string); ?> ---[ End of PHP Example ]--- Good luck! </Reply> -- * R&zE: -- »»»»»»»»»»»»»»»»»»»»»»»» -- Renze Munnik -- DataLink BV -- -- E: renze@datalink.nl -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- ««««««««««««««««««««««««

« previous php.general (#72450) next »