Analysis of precautions for passing a value in a php function. Php function reference transfer notes analysis, this article describes the php function reference transfer notes. For your reference, the details are as follows: Analysis of precautions for passing Stri php function values, and analysis of php functions
This article describes the reference and transfer notes for php functions. We will share this with you for your reference. The details are as follows:
Strict standards: Only variables shocould be passed by reference
There is such a sentence on the Internet:
This problem may occur in php5.3 or later versions. It should also be related to the php configuration. if you split this sentence into two sentences, there will be no problem.Because the array_walk parameter is passed by reference, by default, more than 5.3 can only pass specific variables, but cannot return values through the function.Of course, you can also modify error_reporting = E_ALL | E_STRICT in php. ini, but this does not comply with the rules.
$ Suffix = array_pop (explode (".", $ file_name ));
Why is this restriction imposed by the higher version?
Let me see the function prototype in the manual:
Mixed array_pop (array & $ array) bool array_walk (array & $ array, callable $ funcname [, mixed $ userdata = NULL])
The & symbol specifies that the variable is passed in. it is passed by reference.
Changed:
$ File_name_arr = explode (".", $ file_name); $ suffix = array_pop ($ file_name_arr );
You can.
In fact, it only generates a warning. Not a fatal error. The normal result is. For example, the suffix of the file name is normal.