Created
October 21, 2021 14:07
-
-
Save dfinke/2a2d9cc0b757cd0973d479a1625ad867 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
function add ($a, $b) { | |
$a + $b | |
} | |
function subtract ($a, $b) { | |
$a - $b | |
} | |
$a, $b = 4, 5 | |
$fn = if($a -gt $b) {'subtract'} else {'add'} | |
&$fn $a $b # 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment