fork download
  1. <?php
  2.  
  3. function assertion(){
  4. $args = func_get_args();
  5. foreach($args[0] as $assert)
  6. if(!call_user_func_array($assert, array_slice($args, 1)))
  7. return false;
  8. return true;
  9. }
  10.  
  11. $conditionSet = [
  12. function($a, $b){ return $a > $b; },
  13. function($a, $b, $c, $d){ return $c != $d; },
  14. function($a, $b, $c, $d, $e, $f){ return $f < $e; }
  15. ];
  16.  
  17. if( assertion($conditionSet, 2, 1, 3, 4, 6, 5) )
  18. echo 'All conditions true';
  19. else
  20. echo 'One or more conditions false';
Success #stdin #stdout 0.01s 20520KB
stdin
Standard input is empty
stdout
All conditions true