Why count() returns no error when string is given ?

From: Date: Tue, 16 Aug 2011 14:29:27 +0000
Subject: Why count() returns no error when string is given ?
Groups: php.general 
Request: Send a blank email to php-general+get-314544@lists.php.net to get a copy of this message
For example when I do: strlen(array(1,2,3)); php shows: Warning: strlen() expects parameter 1 to be string, array given in... but when I do: count('string'); It simply returns 1 like nothing happened. I would expect such behavior if I write: count((array)'string') but otherwise such behavior is very misleading and inconsistent.

« previous php.general (#314544) next »