note 64983 deleted from language.types.type-juggling by bjori

From: Date: Mon, 24 Apr 2006 09:19:43 +0000
Subject: note 64983 deleted from language.types.type-juggling by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-109306@lists.php.net to get a copy of this message
Note Submitter: Reason: bad code ---- There seems to be a problem with string hexadecimals and type juggling. The following expectedly ignores the hexadecimal value since floats are only specifiable in decimal. <?php var_dump ((float) "0x31"); // (float)0 var_dump (1.5+(float)"0x31"); // (float)1.5 ?> However, the following seems to first convert the hexadecimal string to an integer (which does allow hexadecimals) and then to a float, rather than immediately converting to float, as the documentation here on type juggling would have it: <?php var_dump (1.5+"0x31"); // (int)50.5 (i.e., 1.5+49) ?>

« previous php.notes (#109306) next »