Re: [PHP] String breaking up
Strings are arrays, so you can print out a string by doing something like this: $string = hey there!; for ($i=0; $icount($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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] String breaking up
To be more precise add the br at the end of the line between the for loop: Strings are arrays, so you can print out a string by doing something like this: $string = hey there!; for ($i=0; $icount($string); $i++) { echo strtoupper($string[$i]).'br'; } 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] String breaking up
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; $icount($string); $i++) { echo strtoupper($string[$i]); } becomes: $string = hey there!; for ($i=0; $icount($string); $i++) { echo $string[$i]\n; // or br if you want to use HTML } Kees -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] String breaking up
$string = hey there!; $out = ''; for ($i=0; $icount($string); $i++) { $out .= strtoupper($string[$i]) . \n; // or br if output is to browser } echo $out; Richard Baskett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Strings are arrays, so you can print out a string by doing something like this: $string = hey there!; for ($i=0; $icount($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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] String breaking up
This only returns the first letter? --- _lallous [EMAIL PROTECTED] wrote: $string = hey there!; $out = ''; for ($i=0; $icount($string); $i++) { $out .= strtoupper($string[$i]) . \n; // or br if output is to browser } echo $out; Richard Baskett [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Strings are arrays, so you can print out a string by doing something like this: $string = hey there!; for ($i=0; $icount($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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] = 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] String breaking up
Original message From: Dan McCullough [EMAIL PROTECTED] Date: Fri, Oct 26, 2001 at 06:03:00AM -0700 Message-ID: [EMAIL PROTECTED] 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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] /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 (/(.)/, \\1br, $string); Again, see the example below: ---[ PHP Example ]--- ?php $string = Dan is great; $string = preg_replace (/(.)/, \\1br, $string); print ($string); ? ---[ End of PHP Example ]--- Good luck! /Reply -- * RzE: -- -- Renze Munnik -- DataLink BV -- -- E: [EMAIL PROTECTED] -- W: +31 23 5326162 -- F: +31 23 5322144 -- M: +31 6 21811143 -- -- Stationsplein 82 -- 2011 LM HAARLEM -- Netherlands -- -- http://www.datalink.nl -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]