What are the advantages of using Closures over create_function() in PHP?
Using closures in PHP provides several advantages over using create_function(): 1. Closures are more readable and maintainable as they are defined using a more familiar syntax. 2. Closures have access to variables in the parent scope without needing to explicitly pass them as arguments. 3. Closures are more efficient in terms of performance compared to create_function().
// Using closures instead of create_function()
$addition = function ($a, $b) {
return $a + $b;
};
echo $addition(2, 3); // Output: 5