fork download
  1. <?php
  2.  
  3. function add( $a, $b ) {
  4. return $a + $b;
  5. }
  6.  
  7. function mul( $a, $b ) {
  8. return $a * $b;
  9. }
  10.  
  11. $opers = ['mul','add'];
  12.  
  13. foreach ($opers as $oper) {
  14. echo $oper .': '. ($oper)(3, 7) . PHP_EOL;
  15. }
  16.  
  17.  
Success #stdin #stdout 0.02s 82560KB
stdin
Standard input is empty
stdout
mul: 21
add: 10