Is there a split function in PHP that works similar to the JavaScript split()? For some reason explode() returns an array of length 1 when an empty string is given.
Example:
$aList = explode(",", ""); -> to return a 0-length array
$aList = explode(",", "1"); -> to return a 1-length array $aList[0] = 1
$aList = explode(",", "1,5"); -> to return a 2-length array $aList[0] = 1 and $aList[1] = 5
preg_split('~,~',$some_string,-1,PREG_SPLIT_NO_EMPTY)with thePREG_SPLIT_NO_EMPTYflag. php.net/manual/en/function.preg-split.php