[pmwiki-devel] trim() snag...

J. Meijer commentgg at hotmail.com
Thu May 10 12:40:04 CDT 2007

> ---------- Original message ----------
> From: The Editor <editor at fast.st>
> To: PmWiki Devel <pmwiki-devel at pmichaud.com>
> Hit a snag trying to improve the routine I used to manage CSV's
> I use this routine to strip the extra spaces out of a CSV list like:
> Bob  ,  Joe, Dave  , Ed
>         $i = explode(",", $value);
>         foreach ($i as $ii) {
>                 $out[] = trim($ii);
>                 }
>         $value = implode(",", $out);
> Can anyone see what I'm doing wrong? It seems to be having no effect
> on the spaces...
> Cheers,
> Dan

Works fine here but why not:

  $value=preg_replace('/ *, */',',',$value);


Create the ultimate e-mail address book. Import your contacts to Windows Live Hotmail.

More information about the pmwiki-devel mailing list