3v4l.org

run code in 300+ PHP versions simultaneously
<?php $facts = []; $facts['A'] = true; $facts['B'] = false; $test = '(A || B);'; $ruleExecutor = function ($_rule) use ($facts) { $_condition = preg_replace('/(\w+)/', '$$1', $_rule); //(A || B) => ($A || $B) extract($facts); unset($facts); var_dump($_condition); return eval($_condition); }; var_dump($ruleExecutor($test)); var_dump($facts); ?>
Output for git.master, git.master_jit, rfc.property-hooks
string(11) "($A || $B);" NULL array(2) { ["A"]=> bool(true) ["B"]=> bool(false) }

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:
32.27 ms | 401 KiB | 8 Q