RE: [PHP] Text Parser
| From: | Jesse Castro | Date: | Wed, 24 Nov 2004 19:20:01 +0000 |
| Subject: | RE: [PHP] Text Parser | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-202788@lists.php.net to get a copy of this message | ||
[snip]
I need to get a procedure able to do this:
1) Receive a string. For example: "name age address location".
2) Process that string, inserting "comas" between the words in the middle. For
example: "name,age,address,location". It´s important that the comas must be inserted
after the first word, and before the last one.
3) Return that string.
[/snip]
$old = "name age address location";
$new = str_replace(" ", ",", $old);