The examples in this article describe the reference passing precautions for php function passing by value. Share it with everyone for your reference, the details are as follows:
Strict standards: Only variables should be passed by reference
I found information on the Internet and there is this sentence:
This problem will occur in php5.3 and above versions. It should also be related to the configuration of php. As long as you split this sentence into two sentences, there will be no problem. Because the parameters of array_walk are passed by reference, only specific variables can be passed by default in version 5.3 and above, and values cannot be returned through functions. Of course you can also modify error_reporting = E_ALL | E_STRICT in php.ini, but this does not comply with the specification after all.
$suffix = array_pop(explode(".",$file_name));
Why do higher versions have such restrictions?
I’ll look at the function prototype in the manual:
mixed array_pop ( array &$array ) bool array_walk ( array &$array , callable $funcname [, mixed $userdata = NULL ] )
& symbol specifies the variable to be passed in, which is passed by reference.
changed to:
$file_name_arr = explode(".",$file_name); $suffix = array_pop($file_name_arr);
That’s it.
Actually, it just reports a warning. Not a fatal error. Normal results can be obtained. For example, it is normal to get the suffix of the file name here.
Readers who are interested in more PHP-related content can check out the special topics of this site: "Introduction Tutorial on PHP Object-Oriented Programming", "Summary of PHP Mathematical Operation Skills", "Summary of PHP Office Document Operation Skills (including word, excel, access, ppt)", "Complete PHP Array (Array) Operation Skills", "PHP Data Structure and Algorithm Tutorial", "php Programming Algorithm Summary", "php Regular Expression Usage Summary", and "php Common Database Operation Skills" Summary》
I hope this article will be helpful to everyone in PHP programming.