Req #35950 [Opn]: Integer conversion and hex values

From: Date: Fri, 09 Jan 2015 00:02:45 +0000
Subject: Req #35950 [Opn]: Integer conversion and hex values
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-189795@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=35950&edit=1

 ID:                 35950
 Updated by:         ajf@php.net
 Reported by:        tomas_matousek at hotmail dot com
 Summary:            Integer conversion and hex values
 Status:             Open
 Type:               Feature/Change Request
 Package:            *General Issues
-Operating System:   Irrelevant
+Operating System:   *
-PHP Version:        5.1.2
+PHP Version:        *
 Block user comment: N
 Private report:     N

 New Comment:

This would be fixed by this RFC (it removes hex support): https://wiki.php.net/rfc/remove_hex_support_in_numeric_strings


Previous Comments:
------------------------------------------------------------------------
[2006-01-09 20:37:41] tomas_matousek at hotmail dot com

int(17) should be there, of course.

------------------------------------------------------------------------
[2006-01-09 20:36:46] tomas_matousek at hotmail dot com

Description:
------------
Why is (int) conversion ignoring hexadecimals if all other operation using integer conversions
convert them?
I think (int) conversion should also convert hexadecimals to be consistent with others.

Reproduce code:
---------------
$a = "0x10";

var_dump((int)$a,$a * 1,$a == "16");

Expected result:
----------------
int(16)
int(16)
int(17)
bool(true)

Actual result:
--------------
int(0)
int(16)
int(17)
bool(true)


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=35950&edit=1


Thread (4 messages)

« previous php.bugs (#189795) next »