note 85274 deleted from function.empty by danbrown

From: Date: Thu, 12 Feb 2009 18:20:12 +0000
Subject: note 85274 deleted from function.empty by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-150586@lists.php.net to get a copy of this message
Note Submitter: justin at booleangate dot org ---- @john_jian, et al PHP does have explicit type casting. Also consider that, due to the implicit casting that Anonymous pointed out, "-" == (int)"-" and "+" == (int)"-" both evaluate as bool(true). var_dump("-" == (int)"-"); var_dump("+" == (int)"-"); This is small hiccup that I ran into a few weeks back when validating some user input. I thought it was a bug at first, but it's not, it's just one of those gotchas that crop up sometimes when dealing with a typeless language. It would be preferable, however, if PHP could raise an E_NOTICE when it encounters a cast that results in a default value such as in the above case.

« previous php.notes (#150586) next »