note 16021 added to function.explode

From: Date: Fri, 12 Oct 2001 16:24:03 +0000
Subject: note 16021 added to function.explode
Groups: php.notes 
Request: Send a blank email to php-notes+get-18862@lists.php.net to get a copy of this message
Pretty obvious, but be careful if the seperator is in front of the string you want to explode. $array[0] will be "" and the different parts will only start at $array[1] Example: $string = "-first-second-third"; $array = explode("-",$string); Gives this: $array[0] => "" $array[1] => "first" $array[2] => "second" $array[3] => "third" Either start using your array at position 1, either trim your string beforehand. -- http://www.php.net/manual/en/function.explode.php http://master.php.net/manage/user-notes.php?action=edit+16021 http://master.php.net/manage/user-notes.php?action=delete+16021 http://master.php.net/manage/user-notes.php?action=reject+16021

« previous php.notes (#18862) next »