Last active
September 16, 2024 15:08
-
-
Save datashaman/2698e9d471b3fe82f2c1b5f576e94ede to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return [ | |
'add' => fn ($a, $b) => $a + $b, | |
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
['add' => $add] = include('calc.php'); | |
echo $add(2, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The use of an array is not ideal, but it allows for selection of functions using object destructuring assignment.