note 51209 added to function.preg-split

From: Date: Wed, 23 Mar 2005 16:41:37 +0000
Subject: note 51209 added to function.preg-split
Groups: php.notes 
Request: Send a blank email to php-notes+get-86847@lists.php.net to get a copy of this message
preg_split() behaves differently from perl's split() if the string ends with a delimiter. This perl snippet will print 5: my @a = split(/ /, "a b c d e "); print scalar @a; The corresponding php code prints 6: print count(preg_split("/ /", "a b c d e ")); This is not necessarily a bug (nowhere does the documentation say that preg_split() behaves the same as perl's split()) but it might surprise perl programmers. ---- Manual Page -- http://www.php.net/manual/en/function.preg-split.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+51209 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+51209&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+51209&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+51209&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+51209&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+51209&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+51209&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86847) next »