note 83463 added to function.preg-split

From: Date: Tue, 27 May 2008 14:08:43 +0000
Subject: note 83463 added to function.preg-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-139854@lists.php.net to get a copy of this message
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.) ---- Server IP: 80.67.2.2 Probable Submitter: 194.237.142.7 ---- Manual Page -- http://www.php.net/manual/en/function.preg-split.php Edit -- https://master.php.net/note/edit/83463 Del: integrated -- https://master.php.net/note/delete/83463/integrated Del: useless -- https://master.php.net/note/delete/83463/useless Del: bad code -- https://master.php.net/note/delete/83463/bad+code Del: spam -- https://master.php.net/note/delete/83463/spam Del: non-english -- https://master.php.net/note/delete/83463/non-english Del: in docs -- https://master.php.net/note/delete/83463/in+docs Del: other reasons-- https://master.php.net/note/delete/83463 Reject -- https://master.php.net/note/reject/83463 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#139854) next »