note 14863 added to language.operators.comparison.php

From: Date: Fri, 17 Aug 2001 21:55:16 +0000
Subject: note 14863 added to language.operators.comparison.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-16859@lists.php.net to get a copy of this message
Hi folks -- quick hack-fix: Situation: you do a db query where the result can be either 0 or NULL (or some other value). You want to test to see which is which. For whatever reason, you can't seem to get any equality test to say that 0 is not equal to ''. Don't sweat it: do a strlen() on the value. If it's 0, the strlen will be 1. If it's '', the strlen will be 0. Dirty little hack and all... http://www.php.net/manual/en/language.operators.comparison.php

« previous php.notes (#16859) next »