Issue
I was working on Windows 64 Bit with 32 Bit php on it. Using base_convert After i have moved to Centos 64 Bit with 64 Bit php returns different results. For example:
<?php
$input = 'f00706ff';
$result = (int)base_convert($input,16,10);
echo $result;
?>
On Win64 PHP32 -> 2147483647;
On CentOS64 PHP64 -> 4026992383;
Any help?
Solution
Found the solution.
<?php
$input = 'f00706ff';
$result = (int)base_convert($input,16,10);
if($result > 2147483647) $result = 2147483647;
echo $result;
?>
Where 2147483647 = PHP_INT_MAX in 32 BIT
Answered By - Sahil
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.