note 41599 deleted from language.operators.logical by nlopess

From: Date: Fri, 16 Apr 2004 13:31:32 +0000
Subject: note 41599 deleted from language.operators.logical by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-68203@lists.php.net to get a copy of this message
Note Submitter: mukeisatsu@msn.com ---- Note that XOR doesn't actually an integer. This doesn't matter in PHP alone since it's typecasting is so flexible, but if you're interacting with other systems (SQL, for example) it can be problematic. For example: <? $a = 0; $b = 1; $test = $a xor $b; // Assuming val is an integer in the database, this will always assign 0 mysql_query("INSERT INTO table (val) VALUES ($test)"); // To make this work properly, you have to use intval() mysql_query("INSERT INTO table (val) VALUES (" . intval($test) . ")"); ?>

« previous php.notes (#68203) next »