Monthly Archives: March 2017

Closure Binding as an alternative to “use” variables

As a general rule when creating a Closure, arguments are passed when the function is called, but “use” variables (I’m sure that they have a formal name, but have no idea what it might be, so I just refer to … Continue reading

Posted in PHP | Tagged , , , | 16 Comments

Closures, Anonymous Classes and an alternative approach to Test Mocking (Part 1)

Since their first introduction with PHP 5.3, Closures have proven an incredibly useful feature for writing simple callback code, making it cleaner and more intuitive. Anonymous Functions can be used inline for many of the array functions $price = 100.00; … Continue reading

Posted in PHP | Tagged , , , , | 7 Comments