Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $add = function($x,$y){
- return $x + $y;
- };
- $sub = function($x,$y){
- return $x - $y;
- };
- $mul = function($x,$y){
- return $x * $y;
- };
- $div = function($x,$y){
- return $x / $y;
- };
- function calculate($x,$y,$fn){
- return $fn($x,$y);
- }
- echo calculate(100,200, $add);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement