note 64983 added to language.types.type-juggling

From: Date: Mon, 24 Apr 2006 07:59:23 +0000
Subject: note 64983 added to language.types.type-juggling
Groups: php.notes 
Request: Send a blank email to php-notes+get-109301@lists.php.net to get a copy of this message
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) ?> ---- Server IP: 66.163.161.117 Probable Submitter: 218.17.94.14 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/language.types.type-juggling.php Edit -- http://master.php.net/note/edit/64983 Del: integrated -- http://master.php.net/note/delete/64983/integrated Del: useless -- http://master.php.net/note/delete/64983/useless Del: bad code -- http://master.php.net/note/delete/64983/bad+code Del: spam -- http://master.php.net/note/delete/64983/spam Del: non-english -- http://master.php.net/note/delete/64983/non-english Del: in docs -- http://master.php.net/note/delete/64983/in+docs Del: other reasons-- http://master.php.net/note/delete/64983 Reject -- http://master.php.net/note/reject/64983 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#109301) next »