Array_walk_recursive: how to use anonymous functions

Source: Internet
Author: User
Array_walk_recursive uses anonymous functions. it is found that my local phpStudy integrated environment PHP5.3.26 can pass in an anonymous function in the second parameter, but it is not supported to run php5.3.27 on the test linux host deployed on the company's intranet, a function name string must be passed in for execution. how can I set it to support anonymous functions?


Reply to discussion (solution)

The anonymous function can be used at the beginning of 5.3, so there should be no problem. We recommend that you paste the code and error information for analysis.

$ Arr = array (1, 2, 3, 4, 5 );
Array_walk_recursive ($ arr, function ($ value ){
Echo $ value;
});

E_WARNING, array_walk_recursive () expects parameter 2 to be a valid callback, no array or string given

================
Unless this function is defined, the function name is passed in as a string.

How many php versions do you use? echo phpversion.

It seems that this writing method is not supported

How many php versions do you use? echo phpversion.

5.3.27

============

It seems that this writing method is not supported
I can use phpstudy 5.3.26.

What is this?
5.3.26 or 5.3.27 or 5.3.29.
It is obviously a mistake in version maintenance. just change the version.
According to the general version maintenance rules, the minor version number is even, and the stability is high.

Now 5.5 has been officially released. What are the lower versions involved?

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.