Why programmers use Anonymous functions most in Javascript but not in PHP?

I have just started learning Javascript and I see almost every tutorials whether it is 2+2 calculation, they always use the closure or anonymous functions but in opposite for PHP handler they don’t use much closure, they make the normal functions to and return the value.

What is the difference here?

PHP has only relatively recently started supporting the this keyword, and is much more of a procedural language. By comparison, JavaScript makes much more use of functional language techniques.

You can learn more about closure from Let’s Learn JavaScript Closures

Another good resource about closure and anonymous functions can be found at Understand JavaScript Callback Functions and Use Them

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.