RE: [PHP] Split(), Explode()..

From: Date: Thu, 19 Oct 2000 04:48:14 +0000
Subject: RE: [PHP] Split(), Explode()..
Groups: php.general 
Request: Send a blank email to php-general+get-21078@lists.php.net to get a copy of this message
Yes, Yes ... <PRE> H e l l o W o r l d </PRE> It worked! Thanks Matthias! -----Original Message----- From: Matthias Endler [mailto:endler@upsys.de] Sent: Thursday, October 19, 2000 1:34 PM To: PHP-GENERAL Subject: RE: [PHP] Split(), Explode().. Hi Maxim, > I have a simple (hopefully) question: > > I am trying to reformat the string by letters: > > $string = explode("", 'Hello World'); > echo implode (' ', $string); > > What I want is to separate each character of the string by whitespaces. > Plus I want to keep the array ($string) for feature use. > > The code above gives me the following errors: > Warning: Empty delimiter in /blah/blah.html on line 93 > Warning: Bad arguments to implode() in /blah/blah.html on line 94 > > I also tried to use split: > > $string = split ("", 'Hello World'); > echo implode (' ', $string); > > and the errors received were: > Warning: unexpected regex error (14) in /blah/blah.html on line 93 > Warning: Bad arguments to implode() in /blah/blah.html on line 94 > > Anyone has an idea how to do it? > Any function I don't know that does that? > > Can a loop help me? Regex? (BTW, the speed is pretty important) I had the same problem yesterday... $string = preg_split("//", 'Hello World'); that works. Cheers, Matthias -- 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

« previous php.general (#21078) next »