note 18290 deleted from function.explode by didou

From: Date: Sun, 07 Dec 2003 03:11:30 +0000
Subject: note 18290 deleted from function.explode by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-61578@lists.php.net to get a copy of this message
Note Submitter: mrnasty@gmx.net ---- sometimes a problem may occur, if user add a separator char at the end: "item1, item2, item3, item4,", so the last would be an empty array-item. you can fix this with using $string = trim($string,$separator); additionally it would be useful to get rid of the spaces leading (or following) each item: $string = trim($string,$separator); $strarray = explode($separator,$string); foreach ($strarray as $stritem) $stritem = trim($stritem); hope this helps, + stefan

« previous php.notes (#61578) next »