note 67972 added to function.sizeof
| From: | stoobers at yahoo dot com | Date: | Fri, 07 Jul 2006 19:27:40 +0000 |
| Subject: | note 67972 added to function.sizeof | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114581@lists.php.net to get a copy of this message | ||
here is a significant gotcha!
sizeof($a) gives the size of $a when $a is an array.
but call it on a string and it will return 1. it won't treat a string like a char array, as
the c language does. to get the size of a string, use strlen. also, there is no end of string
character counted by strlen.
----
Server IP: 216.194.113.175
Probable Submitter: 71.118.124.202
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.sizeof.php
Edit -- http://master.php.net/note/edit/67972
Del: integrated -- http://master.php.net/note/delete/67972/integrated
Del: useless -- http://master.php.net/note/delete/67972/useless
Del: bad code -- http://master.php.net/note/delete/67972/bad+code
Del: spam -- http://master.php.net/note/delete/67972/spam
Del: non-english -- http://master.php.net/note/delete/67972/non-english
Del: in docs -- http://master.php.net/note/delete/67972/in+docs
Del: other reasons-- http://master.php.net/note/delete/67972
Reject -- http://master.php.net/note/reject/67972
Search -- http://master.php.net/manage/user-notes.php