note 75999 added to function.substr
| From: | lanny at freemail dot hu | Date: | Tue, 26 Jun 2007 10:31:04 +0000 |
| Subject: | note 75999 added to function.substr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-127981@lists.php.net to get a copy of this message | ||
Starting from version 5.2.3 if $start is negative and larger then the length of the string, the
result is an empty string, while in earlier versions the result was the string itself!
substr ("abcdef", -1000);
result in 5.2.0
'abcdef'
result in 5.2.3
''
This is a small inconsistency, one of those things that makes the life of a PHP programmer like
hell.
----
Server IP: 195.70.37.52
Probable Submitter: 213.178.101.196
----
Manual Page -- http://www.php.net/manual/en/function.substr.php
Edit -- https://master.php.net/note/edit/75999
Del: integrated -- https://master.php.net/note/delete/75999/integrated
Del: useless -- https://master.php.net/note/delete/75999/useless
Del: bad code -- https://master.php.net/note/delete/75999/bad+code
Del: spam -- https://master.php.net/note/delete/75999/spam
Del: non-english -- https://master.php.net/note/delete/75999/non-english
Del: in docs -- https://master.php.net/note/delete/75999/in+docs
Del: other reasons-- https://master.php.net/note/delete/75999
Reject -- https://master.php.net/note/reject/75999
Search -- https://master.php.net/manage/user-notes.php