note 90217 deleted from function.explode by danbrown

From: Date: Fri, 10 Apr 2009 19:14:21 +0000
Subject: note 90217 deleted from function.explode by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-153057@lists.php.net to get a copy of this message
Note Submitter: mike ---- If you explode an empty string, it does not return an empty array. It returns a single element array with an empty element. $test = ''; $test_array = explode(',',$test); print_r($test_array); // returns Array ( [0] => ) I was expecting it to act more like this: $test = ''; $test_array = $test ? explode(',',$test) : array(); print_r($test_array); // returns Array ()

« previous php.notes (#153057) next »