3v4l.org

run code in 300+ PHP versions simultaneously
<?php function any(array $array, callable $predicate) { return ((bool) count($array)) && array_reduce($array, function ($bool, $item) use ($predicate) { return $bool || (bool) $predicate($item); }, false); } function all(array $array, callable $predicate) { return ((bool) count($array)) && array_reduce($array, function ($bool, $item) use ($predicate) { return $bool && (bool) $predicate($item); }, true); } $valuesArray = [ [ false, false, false ], [ false, false, true ], [ false, true, false ], [ false, true, true ], [ true, false, false ], [ true, false, true ], [ true, true, false ], [ true, true, true ], ]; foreach ($valuesArray as $values) { printf('Any for (%s) is %s' . PHP_EOL, implode(', ', array_map(function ($value) { return $value ? 'Yeop' : 'Nope'; }, $values)), any($values, function ($value) { return $value; }) ? 'Yeop' : 'Nope'); printf('All for (%s) is %s' . PHP_EOL, implode(', ', array_map(function ($value) { return $value ? 'Yeop' : 'Nope'; }, $values)), all($values, function ($value) { return $value; }) ? 'Yeop' : 'Nope'); echo PHP_EOL; }
Output for git.master, git.master_jit, rfc.property-hooks
Any for (Nope, Nope, Nope) is Nope All for (Nope, Nope, Nope) is Nope Any for (Nope, Nope, Yeop) is Yeop All for (Nope, Nope, Yeop) is Nope Any for (Nope, Yeop, Nope) is Yeop All for (Nope, Yeop, Nope) is Nope Any for (Nope, Yeop, Yeop) is Yeop All for (Nope, Yeop, Yeop) is Nope Any for (Yeop, Nope, Nope) is Yeop All for (Yeop, Nope, Nope) is Nope Any for (Yeop, Nope, Yeop) is Yeop All for (Yeop, Nope, Yeop) is Nope Any for (Yeop, Yeop, Nope) is Yeop All for (Yeop, Yeop, Nope) is Nope Any for (Yeop, Yeop, Yeop) is Yeop All for (Yeop, Yeop, Yeop) is Yeop

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:
50.1 ms | 402 KiB | 8 Q