Problems with large Array count group subscript

Source: Internet
Author: User
The test code is as follows:

$int  = 135893597710;print_r ($int);p Rint_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


Reply to discussion (solution)

 
  1));? >

Now the problem is that the production service is Linux, there is a batch of data is serialize processing after the storage, now I lead to the local, there is no way to restore, because there are some arrays of the subscript is such a large number. So, if I want to use the data Rush test environment locally, we must solve the output problem of the test code above

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 large integers to string print_r (Unserialize ($s)); Check for deserialization results
Array
(
[135893597710] = 123
)

Production service is Linux64 bit, but my windows is 64 bit yes, I also replaced PHP 64-bit, attempted

At present decided to use upstairs method, after all, just test environment, can use just fine, first not tangled. But if a friend can find the real reason better ~

Is your Windows also 64-bit? So can you compile PHP yourself?
PHP does not issue a 64-bit version of the for window

PHP has third-party compiled x64
But
Test Max int is still 2^32-1 (Win7 x64)

Is your Windows also 64-bit? So can you compile PHP yourself?
PHP does not issue a 64-bit version of the for window

I compiled my own 64-bit PHP and the WAMP64-bit version of the Web download, no

Since you can compile PHP yourself, please check the 64-bit compilation switch to open No
Also must be VC9 above the compiler, preferably VC10 above the

  • 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.