#31302 [Opn->WFx]: empty() shouldn't count ' ', '\n', etc

From: Date: Sun, 26 Dec 2004 10:32:43 +0000
Subject: #31302 [Opn->WFx]: empty() shouldn't count ' ', '\n', etc
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-71076@lists.php.net to get a copy of this message
ID: 31302 Updated by: derick@php.net Reported By: aitrus at tresgeek dot net -Status: Open +Status: Wont fix Bug Type: Feature/Change Request PHP Version: 4.3.10 New Comment: We can't change this due to BC reasons, also, it doesn't fit a particular language construct (empty is NOT a function!) Previous Comments: ------------------------------------------------------------------------ [2004-12-26 07:43:20] aitrus at tresgeek dot net Description: ------------ I thought that this used to be the behavior of empty()... It would be nice of empty() returned true when passed a string which only had spaces, tabs, or newline characters in it. Reproduce code: --------------- $foo = ' '; if ( empty( $foo ) ) { echo "foo is empty"; } else { echo "foo is NOT empty"; }//if --- output is: 'foo is NOT empty' Expected result: ---------------- expected output: 'foo is empty' ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=31302&edit=1

« previous php.bugs (#71076) next »