3v4l.org

run code in 300+ PHP versions simultaneously
<?php $emptyValue = "null"; $trueValue = "ok"; $falseValue = "nok"; $trueArray = [ 1,'1',true,'true','yes' ]; $falseArray = [ 0,'0',false,'false','no' ]; function testdata($data) { global $trueArray, $falseArray, $emptyValue, $trueValue, $falseValue; if( in_array($data, $trueArray, true) ) { return $trueValue; } elseif( in_array($data, $falseArray, true) ) { return $falseValue; } else { return $emptyValue; } } var_dump(testdata(false)); var_dump(testdata(true)); var_dump(testdata('true')); var_dump(testdata('false')); var_dump(testdata('yes')); var_dump(testdata('no')); var_dump(testdata('')); var_dump(testdata(1)); var_dump(testdata(0));
Output for git.master, git.master_jit, rfc.property-hooks
string(3) "nok" string(2) "ok" string(2) "ok" string(3) "nok" string(2) "ok" string(3) "nok" string(4) "null" string(2) "ok" string(3) "nok"

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