PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, February 11, 2022

[FIXED] Moved from Windows 32 Bit to Linux 64 Bit, base_convert() issues

 February 11, 2022     centos, lamp, php     No comments   

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
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing