#29884 [Bgs]: incorrect intval return
| From: | babansky at cox dot net | Date: | Mon, 30 Aug 2004 06:11:31 +0000 |
| Subject: | #29884 [Bgs]: incorrect intval return | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-65432@lists.php.net to get a copy of this message | ||
ID: 29884
User updated by: babansky at cox dot net
Reported By: babansky at cox dot net
Status: Bogus
Bug Type: Strings related
Operating System: Mandrake 9.2
PHP Version: 4.3.7
New Comment:
Yet you'd expect intval to return decimal number and not octal (!!).
The default intval base is 10.
Try the same script with $str_value='0912345678';
and $str_value='09123456789' to see the difference;
Previous Comments:
------------------------------------------------------------------------
[2004-08-30 06:49:31] tony2001@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
Read about octal numbers and type-juggling here:
http://www.php.net/manual/en/language.types.integer.php
------------------------------------------------------------------------
[2004-08-29 22:57:13] babansky at cox dot net
Description:
------------
if you try to do intval on the following string:
$str_value='09123456789';
you receive the following: 2147483647
Reproduce code:
---------------
$str_value='09123456789';
echo "str_value -> $str_value<BR>";
$num_value=intval($str_value);
echo "num_value -> $num_value<BR>";
Expected result:
----------------
$num_value = 9123456789
Actual result:
--------------
$num_value=2147483647
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=29884&edit=1