Edit report at https://bugs.php.net/bug.php?id=60402&edit=1
ID: 60402 Updated by: cataphr...@php.net Reported by: alagar86 at gmail dot com Summary: "0.0" (0.0 as a string) values are considered as not empty -Status: Open +Status: Bogus Type: Bug Package: *General Issues Operating System: Windows/Linux PHP Version: 5.3.8 Block user comment: N Private report: N New Comment: The manual says 0.0 (i.e. the same as 0., or (float) 0), not "0.0" (a string). Closing as bogus. Previous Comments: ------------------------------------------------------------------------ [2011-11-28 14:44:36] alagar86 at gmail dot com Description: ------------ Hi PHP team. For empty() we have the following rule : The following things are considered to be empty: "" (an empty string) 0 (0 as an integer) 0.0 (0 as a float) "0" (0 as a string) But values like "0.0" are cosidered as not empty for example : $zeroFloatString = "0.0"; (0.0 as a string) var_dump(empty($zeroFloatString)); prints false . However the $zeroFloatString contains "0.0" value. Thanks, Anton Test script: --------------- $emptyString = ""; (an empty string) $zeroInt = 0; (0 as an integer) $zeroFloat = 0.0; (0 as a float) $zeroString = "0"; (0 as a string) $zeroFloatString = "0.0"; (0.0 as a string) var_dump(empty($emptyString)); true var_dump(empty($zeroInt)); true var_dump(empty($zeroFloat)); true var_dump(empty($zeroString)); true var_dump(empty($zeroFloatString)); false Expected result: ---------------- bool(true) bool(true) bool(true) bool(true) bool(true) Actual result: -------------- bool(true) bool(true) bool(true) bool(true) bool(false) // var_dump(empty($zeroFloatString)) where $zeroFloatString = "0.0" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60402&edit=1