Re: Re: foreach with null
| From: | Jani Taskinen | Date: | Thu, 27 Oct 2005 10:10:20 +0000 |
| Subject: | Re: Re: foreach with null | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-19757@lists.php.net to get a copy of this message | ||
On Wed, 26 Oct 2005, Ilia Alshanetsky wrote:
Greg Beaver wrote:amen, this behavior makes no sense even though sizeof() is an alias to count(). sizeof('this') and sizeof('this long thing') are both 1, which makes no sense. I would go so far as to say a E_NOTICE is more appropriate than E_STRICT - you should only be using count() for arrays/objects.Actually this result makes perfect sense since type conversion changes string into array('your string') and does a count of that, which is 1.
This is yet another magic type casting I'd like to get rid of..
Strict is not always bad, mmkay? :)
I got bitten by this (unexpected?) behaviour of count() myself this week.
I must have been strict in my mind and not passed anything but arrays
to it before this. :)
--Jani