Split(), Explode()..
| From: | Maxim Maletsky | Date: | Thu, 19 Oct 2000 04:21:07 +0000 |
| Subject: | Split(), Explode().. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-21068@lists.php.net to get a copy of this message | ||
Hello list,
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)
Thanks folks!
Maxim Maletsky - maxim@j-door.com <mailto:maxim@j-door.com>
Webmaster, J-Door.com / J@pan Inc.
LINC Media, Inc.
TEL: 03-3499-2175 x 1271
FAX: 03-3499-3109
http://www.j-door.com <http://www.j-door.com/>
http://www.japaninc.net <http://www.japaninc.net/>
http://www.lincmedia.co.jp <http://www.lincmedia.co.jp/>