3v4l.org

run code in 300+ PHP versions simultaneously
<?php function any($elements, Clousure $x){ foreach($elements as $element){ if($x($element)) return true; } return false; } function all($elements, Clousure $x){ foreach($elements as $element){ if(!$x($element)) return false; } return true; } function minimum($of) { return function($el) use ($of){ if($el < $of) return true; return false; }; } echo "any x <- [1, 2, 3, 4, 5] | < 5" . PHP_EOL; if(any(array(1, 2, 3, 4, 5), minimum(5))) { echo "true" . PHP_EOL; } else { echo "false" . PHP_EOL; }; echo "all x <- [1, 2, 3, 4] | < 5" . PHP_EOL; if(all(array(1, 2, 3, 4), minimum(5))) { echo "true" . PHP_EOL; } else { echo "false" . PHP_EOL; };
Output for git.master, git.master_jit, rfc.property-hooks
any x <- [1, 2, 3, 4, 5] | < 5 Fatal error: Uncaught TypeError: any(): Argument #2 ($x) must be of type Clousure, Closure given, called in /in/UUe6i on line 29 and defined in /in/UUe6i:3 Stack trace: #0 /in/UUe6i(29): any(Array, Object(Closure)) #1 {main} thrown in /in/UUe6i on line 3
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
58.97 ms | 401 KiB | 8 Q