note 118221 added to function.ltrim
| From: | taviundersc10fromyahoocom | Date: | Thu, 29 Oct 2015 10:11:36 +0000 |
| Subject: | note 118221 added to function.ltrim | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204045@lists.php.net to get a copy of this message | ||
When using a $character_mask the trimming stops at the first character that is not on that mask.
So in the $string = "Hello world" example with $character_mask = "Hdle",
ltrim($hello, $character_mask) goes like this:
1. Check H from "Hello world" => it is in the $character_mask, so remove it
2. Check e from "ello world" => it is in the $character_mask, so remove it
3. Check l from "llo world" => it is in the $character_mask, so remove it
4. Check l from "lo world" => it is in the $character_mask, so remove it
5. Check o from "o world" => it is NOT in the $character_mask, exit the function
Remaining string is "o world".
I hope it helps someone as I had a confusing moment with this function.
----
Server IP: 72.52.91.14
Probable Submitter: 195.88.182.10
----
Manual Page -- http://php.net/manual/en/function.ltrim.php
Edit -- https://master.php.net/note/edit/118221
Del: integrated -- https://master.php.net/note/delete/118221/integrated
Del: useless -- https://master.php.net/note/delete/118221/useless
Del: bad code -- https://master.php.net/note/delete/118221/bad+code
Del: spam -- https://master.php.net/note/delete/118221/spam
Del: non-english -- https://master.php.net/note/delete/118221/non-english
Del: in docs -- https://master.php.net/note/delete/118221/in+docs
Del: other reasons-- https://master.php.net/note/delete/118221
Reject -- https://master.php.net/note/reject/118221
Search -- https://master.php.net/manage/user-notes.php