PHP closure feature applications: replace loops to improve code performance .. The cause is a simple php Upload script: www. nowamagic. netlibrarysvedadetail1384 I reconstructed a bit, mainly using an anonymous function instead of the foreach loop, the cause of the closure is to see a simple php Upload script: http://www.nowamagic.net/librarys/veda/detail/1384
I reconstructed it, mainly by replacing the foreach loop with an anonymous function, using the new features of the closure, which also improves the performance. It should be noted that the closure is not completely equivalent to the anonymous function. the closure is implemented through the anonymous function, which is related to the use of the use keyword.
After all, with the addition of many new php features, our programmers must keep pace with the times to constantly optimize code and restructure themselves.
The following is the php part after reconstruction:
= ['IMG '(= (['tmp _ name'], () (, = ['name'] [(, ['tmp _ name' = "\" = (, ("'alt =''/>"
Handler I reconstructed it, mainly replacing the foreach loop with an anonymous function, and using the closure...