note 92846 added to function.strlen
| From: | Adorjan at osu1 dot php dot net | Date: | Tue, 11 Aug 2009 16:26:56 +0000 |
| Subject: | note 92846 added to function.strlen | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-159339@lists.php.net to get a copy of this message | ||
I noticed something odd when I use strlen to count my hash size. He will always return the bit size
of the hash, not the character size.
Example:
$text = hash("sha512",md5("some text"));
echo strlen($text);
It will show 128, which is actually the strength in bit for sha512, or something like that, but it
is not the character size. Sha512 have 95 characters.
I don't know why this thing happens when strlen is used on hash, but on everything else (normal
string) it works as he needs to, which means, he counts how many characters are there.
I hope I helped somebody with this. :-)
----
Server IP: 69.147.83.197
Probable Submitter: 87.116.140.72
----
Manual Page -- http://www.php.net/manual/en/function.strlen.php
Edit -- https://master.php.net/note/edit/92846
Del: integrated -- https://master.php.net/note/delete/92846/integrated
Del: useless -- https://master.php.net/note/delete/92846/useless
Del: bad code -- https://master.php.net/note/delete/92846/bad+code
Del: spam -- https://master.php.net/note/delete/92846/spam
Del: non-english -- https://master.php.net/note/delete/92846/non-english
Del: in docs -- https://master.php.net/note/delete/92846/in+docs
Del: other reasons-- https://master.php.net/note/delete/92846
Reject -- https://master.php.net/note/reject/92846
Search -- https://master.php.net/manage/user-notes.php