note 121951 added to function.ltrim
| From: | Mauro@php.net | Date: | Thu, 30 Nov 2017 13:36:58 +0000 |
| Subject: | note 121951 added to function.ltrim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-209274@lists.php.net to get a copy of this message | ||
I noticed one thing.
Suppose you have to ltrim zeroes from strings like "015", "002", etc. and
convert them back to numbers, eg. using intval.
Suppose you must convert to number "000" too.
In this case:
$trimmedString = ltrim('000', '0');
the value of $trimmedString would be NULL (and I think the docs should mention this).
Anyway, I initially thought I had to conditional check for this '000', but I found that
intval(NULL) returns 0 (this thing is not in the docs of intval but is in a comment)
----
Server IP: 208.43.231.9
Probable Submitter: 93.33.173.166
----
Manual Page -- http://php.net/manual/en/function.ltrim.php
Edit -- https://master.php.net/note/edit/121951
Del: integrated -- https://master.php.net/note/delete/121951/integrated
Del: useless -- https://master.php.net/note/delete/121951/useless
Del: bad code -- https://master.php.net/note/delete/121951/bad+code
Del: spam -- https://master.php.net/note/delete/121951/spam
Del: non-english -- https://master.php.net/note/delete/121951/non-english
Del: in docs -- https://master.php.net/note/delete/121951/in+docs
Del: other reasons-- https://master.php.net/note/delete/121951
Reject -- https://master.php.net/note/reject/121951
Search -- https://master.php.net/manage/user-notes.php