note 83463 deleted from function.preg-split by danbrown
| From: | danbrown@php.net | Date: | Wed, 27 May 2009 13:49:30 +0000 |
| Subject: | note 83463 deleted from function.preg-split by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156067@lists.php.net to get a copy of this message | ||
Note Submitter: fdmembership at example dot com
----
When I try to get \n delimited lines to an array from a file, preg_split gives one more array
element which contains null string. Assume file contains
line1
line2
$lines = preg_split("/\n/", fread($fh, filesize($filename)));
$lines{
[0] => line1
[1] => line2
[2] =>
}
Same problem exists for explode as weel.
(this might be a feature of "PHP", not a problem.)