PHP 4.0 Bug #8268 Updated: type casting problem
| From: | waldschrott@php.net | Date: | Sat, 16 Dec 2000 20:21:31 +0000 |
| Subject: | PHP 4.0 Bug #8268 Updated: type casting problem | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-41611@lists.php.net to get a copy of this message | ||
ID: 8268
Updated by: waldschrott
Reported By: h.radi@nmeat
Old-Status: Open
Status: Bogus
Bug Type: Feature/Change Request
Assigned To:
Comments:
this is expected behaviour (language.types.string.conversion
), 0x1234 is treated as a normal string and the 0 is kept
the rest is dropped
using "2x1234" 2 will be kept
however I guess you want to use hex values, remove any
double quotes
$foo = 0x1234;
will work convert ths value to 4660
Previous Comments:
---------------------------------------------------------------------------
[2000-12-14 21:48:48] h.radi@nmeat
when i cast a string to an integer i have the following problem:
$foo = "0x1234";
$bar = (int)$foo;
echo $bar; // $bar contains 0
so numbers in an string with an other radix then 10 are not casted correctly.
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=8268