I'm checking out some PHP 5.3.0 features and ran across some code on the site that looks quite funny:
public function getTotal($tax)
{
$total = 0.00;
$callback =
/* This line here: */
function ($quantity, $product) use ($tax, &am...
Possible Duplicate:
How do you use anonymous functions in PHP?
Why should i use an anonymous function? I mean, what's the real deal using it?
I just don't really get this. I mean, you use function to make the code more clean or to use it more t...
Possible Duplicate:
How do you use anonymous functions in PHP?
Why should i use an anonymous function? I mean, what's the real deal using it?
I just don't really get this. I mean, you use function to make the code more clean or to use it more t...
The following obviously results in undefined variable.
public function show($locale, $slug)
{
$article = Article::whereHas('translations', function ($query) {
$query->where('locale', 'en')
->where('slug', $slug);
})->first();
return $ar...
WordPress hooks can be used in two ways:
using callback function name and appropriate function
add_action( 'action_name', 'callback_function_name' );
function callback_function_name() {
// do something
}
using anonymous function (closure)
add_act...