ID: 7878
Updated by: zak
Reported By: [EMAIL PROTECTED]
Status: Feedback
Bug Type: Documentation problem
Operating system:
PHP Version: 4.0.3pl1
Assigned To: zak
Comments:
In hindsight, I think that the current behavior is fine and makes sense given how PHP
currently behaves.
People just need to remember that writing a number out in a different base is for
their convenience - PHP sees it as its decimal equivalent and behaves appropriately.
I have assigned it to myself so that it will bug me til I get around to documenting
the behavior.
Previous Comments:
---------------------------------------------------------------------------
[2001-05-06 11:31:04] [EMAIL PROTECTED]
I guess no-one had thoughts about this. What are we going to do with this one?
---------------------------------------------------------------------------
[2000-11-19 00:55:06] [EMAIL PROTECTED]
The base argument for intval has no effect unless the first argument is a string.
I am not sure what the best fix for this is:
We could document that you should make the first argument a string to have the base
argument used.
We could convert the first argument to a string (using convert_to_string_ex) if there
is a second argument
That would mke calls made with base 10 would work as expected:
intval (1000, 11); // Returns 1331
intval ('1000', 11); // Returns 1331
However, calls using other bases might seem a bit odd:
intval ('077', 8); // returns 63
intval (077, 8); // returns 51
This would be because 077 is converted to 63, then the argument is converted to a
string.
Or we could add a warning if the first arg is not a string?
Any thoughts??
---------------------------------------------------------------------------
ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=7878&edit=2
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]