fork download
  1. <?php
  2.  
  3. function section()
  4. {
  5. $args = func_get_args();
  6. $fn = $args[0];
  7. unset($args[0]);
  8. return function() use($fn, $args)
  9. {
  10. };
  11. }
  12.  
  13. function all_fn($predicates)
  14. {
  15. foreach($predicates as $p) {
  16. if (!$p('C')) {
  17. return false;
  18. echo "Found false, bailing out";
  19. }
  20. }
  21. return true;
  22. }
  23.  
  24. function is_char_a($c) { return $c == 'A'; }
  25. function is_char($a, $c) { return $c == $a; }
  26. function is_char_b($c) { return $c == 'B'; }
  27.  
  28. echo all_fn(array(section('is_char', 'B'), section('is_char_b')));
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Standard output is empty