|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-05-06 11:31 UTC] derick@php.net
[2001-05-06 20:44 UTC] zak@php.net
[2001-06-01 16:02 UTC] sniper@php.net
[2001-06-23 13:26 UTC] zak@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 12:00:02 2025 UTC |
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??