note 112411 added to function.strlen
| From: | jasonrohrer at fastmail dot fm | Date: | Thu, 13 Jun 2013 22:48:27 +0000 |
| Subject: | note 112411 added to function.strlen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-195203@lists.php.net to get a copy of this message | ||
PHP's strlen function behaves differently than the C strlen function in terms of its handling
of null bytes ('\0').
In PHP, a null byte in a string does NOT count as the end of the string, and any null bytes are
included in the length of the string.
For example, in PHP:
strlen( "te\0st" ) = 5
In C, the same call would return 2.
Thus, PHP's strlen function can be used to find the number of bytes in a binary string (for
example, binary data returned by base64_decode).
----
Server IP: 69.147.83.199
Probable Submitter: 50.0.7.36
----
Manual Page -- http://php.net/manual/en/function.strlen.php
Edit -- https://master.php.net/note/edit/112411
Del: integrated -- https://master.php.net/note/delete/112411/integrated
Del: useless -- https://master.php.net/note/delete/112411/useless
Del: bad code -- https://master.php.net/note/delete/112411/bad+code
Del: spam -- https://master.php.net/note/delete/112411/spam
Del: non-english -- https://master.php.net/note/delete/112411/non-english
Del: in docs -- https://master.php.net/note/delete/112411/in+docs
Del: other reasons-- https://master.php.net/note/delete/112411
Reject -- https://master.php.net/note/reject/112411
Search -- https://master.php.net/manage/user-notes.php