php5.1.6 case, the recursion appears. Break It! Solution Ideas
Source: Internet
Author: User
php5.1.6 case, the recursion appears. Find Break!!!
$m = Array (' 1 ');
$m [' a '] = $m;
Print_r ($m);
Die
?>
This is a simple test. The result of the output is
Array ([0] = 1 [a] = = array *recursion*)
But the result I want is:
Array ([0] = 1 [a] = = Array ([0] = 1))
Should we change that place? Ask the Great God for answers
------Solution--------------------
Recursion recursion
This is how Print_r displays results when recursion occurs.
That's right, because Print_r is just for debugging, meaning it's okay.
------Solution--------------------
Your PHP version is too low, json_encode error is normal
------Solution--------------------
php5.2.5 can't handle this situation.
Json_encode () [Function.json-encode]: recursion detected
------Solution--------------------
My php Version 5.3.27 output is exactly the array ([0] = 1 [a] + = Array ([0] = 1))
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