A php bug or?..

From: Date: Mon, 08 Aug 2011 20:20:03 +0000
Subject: A php bug or?..
Groups: php.general 
Request: Send a blank email to php-general+get-314430@lists.php.net to get a copy of this message
Hi everyone, As we all know, count() returns 1 if the variable is not an array. Question is: why in the world does it this? If a variable is *notA* an array, it contains *zero* array elements. You can answer: "but no, man, you can say $x="world"; $y=$x{3}; // $y="l" so the variable is treated or can be treated as an array". Well. If strings are treated like arrays, why count($x) doesn't return 5 instead of 1? Just asking. -- With best regards from Ukraine, Andre Skype: Francophile Blog: http://oire.org/menelion Twitter: http://twitter.com/m_elensule Facebook: http://facebook.com/menelion

« previous php.general (#314430) next »