Date: 04/24/99
- Next message: Bug Database: "[PHP-DEV] Bug #1348 Updated: count() can't identify a non-array variable correctly"
- Previous message: thies: "[PHP-DEV] CVS update: php3/functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
From: mike24 <email protected>
Operating system: Linux 2.0.36
PHP version: 3.0.7
PHP Bug Type: Misbehaving function
Bug description: count() can't identify a non-array variable correctly
The manual says that count "returns 1 if the variable is not an array." This can produce inaccurate results if the variable is an array, but has only one element.
Temporary Solution:
Don't use count(). Instead use is_array(), isset(), and sizeof().
Solution:
Set integer returned by count() to (-1) when the tested variable is not an array.
-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>
- Next message: Bug Database: "[PHP-DEV] Bug #1348 Updated: count() can't identify a non-array variable correctly"
- Previous message: thies: "[PHP-DEV] CVS update: php3/functions"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

