As one of my favorite functions, I finally discovered the devil of this function today. Yangsao wrote the following code, and everything was ok when tested locally, but it was SB on the server.
After searching on Google, it probably means that the parameter of empty cannot be a function. Damn, the local area is obviously good. I checked that the local PHP is 5.5 and the server is 5.3. Has this function evolved between the two versions? I searched all the official PHP documents but didn't find any clues. Then I searched frantically on Google and accidentally clicked on the PHP English document interface. Under the introduction of the empty function, I found a line of small characters:
Devil, you don’t want to trick Chinese users like this. Summarize the usage scenarios of empty function:
1. In versions before PHP 5.5, this function is used to check whether the variable assignment is 0, false, empty string, or null. Any non-variable parameter will cause this function to report an error.
2.PHP 5.5 This function can be applied to any value, not limited to variables. It can be a constant, a function return value, etc.