fork(1) download
  1. <?php
  2. function compose($f, $g) {
  3. return function() use($f, $g) { return $f(call_user_func_array($g, func_get_args())); };
  4. }
  5.  
  6. $f = function($x) { return $x + 1; };
  7. $g = function($l) { return count($l); };
  8.  
  9. echo compose($f, $g)([1,2,3]);
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
4