note 78410 added to function.substr
| From: | Jim at osu1 dot php dot net | Date: | Wed, 10 Oct 2007 22:03:17 +0000 |
| Subject: | note 78410 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131286@lists.php.net to get a copy of this message | ||
Just want to note that if you are retrieving sub-strings of length zero, this function breaks in the
base case (the source being an empty string):
substr('123',0,0) returns string(0) ""
substr('12',0,0) returns string(0) ""
substr('1',0,0) returns string(0) ""
but
substr('',0,0) returns bool(false)
Although this is the documented behavior, I would consider it unexpected in many circumstances.
----
Server IP: 69.147.83.197
Probable Submitter: 72.8.117.17
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/78410
Del: integrated -- https://master.php.net/note/delete/78410/integrated
Del: useless -- https://master.php.net/note/delete/78410/useless
Del: bad code -- https://master.php.net/note/delete/78410/bad+code
Del: spam -- https://master.php.net/note/delete/78410/spam
Del: non-english -- https://master.php.net/note/delete/78410/non-english
Del: in docs -- https://master.php.net/note/delete/78410/in+docs
Del: other reasons-- https://master.php.net/note/delete/78410
Reject -- https://master.php.net/note/reject/78410
Search -- https://master.php.net/manage/user-notes.php