Re: Text Parser

From: Date: Wed, 24 Nov 2004 19:10:00 +0000
Subject: Re: Text Parser
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-202786@lists.php.net to get a copy of this message
On Wed, 24 Nov 2004 15:26:44 -0300, Pablo D Marotta <pablo.d.marotta@aexp.com> wrote: > Hi there... > 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. split a string on spaces. http://www.php.net/explode join it again with commas http://lv.php.net/implode function commaList($input) { return implode(',', explode(' ', $input)); }

« previous php.general (#202786) next »