Problems related to the subscript of large Array count group

Source: Internet
Author: User
Problems with large Array count group subscript
The test code is as follows:

$int  = 135893597710;
Print_r ($int);
Print_r (Array ($int =>1));


The output is 135893597710Array on Windows ([ -1545355762] = 1)
Get the right results when you go to Linux 135893597710Array ([135893597710] + 1)


How can I get the correct results on Windows

Share to:


------Solution--------------------
Is your Linux 64-bit? It doesn't seem like it should happen.
Let's not take care of him, wait for a friend of 64 Linux to test it later.
It is assumed that after serialization is such a string: a:1:{i:135893597710;i:123;}
Then there are
$s = ' a:1:{i:135893597710;i:123;} ';
$s = preg_replace_callback ('/I: (\D{10,});
function ($r) {
return sprintf (' s:%d: '%s '; ', strlen ($r [1]), $r [1]);
},
$s); Change a large integer to a string
Print_r (Unserialize ($s)); Check for deserialization results
Array
(
[135893597710] = 123
)
  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.