ID: 16045 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Feedback Bug Type: *General Issues Operating System: All PHP Version: 4.1.1 New Comment:
FWIW, I used the following script and got the correct results: <?php error_reporting(E_ALL); $x = array(1); echo "Count: " . count($x) . "\n"; unset($x[0]); echo "Count: " . count($x) . "\n"; ?> Results: Count: 1 Count: 0 This is on version 4.2.0-dev. and 4.1.2. What does this script produce for you? Torben Previous Comments: ------------------------------------------------------------------------ [2002-03-13 15:11:08] [EMAIL PROTECTED] Hello, Funny logical error: if we have a simple variable, say $x = 1 then count($x) == 1, which is "natural" (I don't think so) And if we have an array $x[0] = 1; count($x) == 1, but after UnSet($x[0]) we still have count($x) = 1! This leads to a very special kind of logical errors which are really hard to track. My suggestion: either: introduce explicit type system (with unions, structs and arrays ;) or: disable count on variables ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=16045&edit=1