Level 52
$var = function() {};
$var();
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
How do you extract an anonymous function in PHP and store it in a variable like you can in javascript?
$config = ['prefix' => 'project', 'as' => 'project.', 'middleware' => ['auth'] ]
//I would like to take the second parameter in this group method and store it in a variable or property named "routes"
Route::group($config, function () {
Route::get('/load', [
'as' => 'load',
'uses' => 'ProjectController@load'
]);
});
$var = function() {};
$var();
Please or to participate in this conversation.