note 1566 modified in function.base-convert by yannick
| From: | yannick@php.net | Date: | Fri, 25 Jul 2008 16:54:42 +0000 |
| Subject: | note 1566 modified in function.base-convert by yannick | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-142704@lists.php.net to get a copy of this message | ||
This would seem to be limited to 31 bits, ie. the range of values that can be converted is 0 -
2147483647 in decimal.
Also, this will convert negative values to positive values, unlike DecHex() which will return a null
string for negative values.
From what I have observed (using PHP 3.0.11) the following statements will set both a and c to a
null string and set b to positive 1.
<?php
$a = base_convert (2147483648, 10, 16);
$b = base_convert (-1, 10, 16);
$c = dechex (-1);
?>
--was--
This would seem to be limited to 31 bits, ie. the range of values that can be converted is 0 -
2147483647 in decimal.
Also, this will convert negative values to positive values, unlike DecHex() which will return a null
string for negative values.
From what I have observed (using PHP 3.0.11) the following statements will set both a and c to a
null string and set b to positive 1.
$a = base_convert (2147483648, 10, 16);
$b = base_convert (-1, 10, 16);
$c = dechex (-1);
http://php.net/manual/en/function.base-convert.php