3v4l.org

run code in 300+ PHP versions simultaneously
<?php $test = [ 'HTTP_REFERER' => 'http_referer' ]; function ternary($test) { return (!empty($test['HTTP_REFERER']) ? $test['HTTP_REFERER'] : (!empty($test['HTTP_ORIGIN']) ? $test['HTTP_ORIGIN'] : (!empty($test['ORIGIN']) ? $test['ORIGIN'] : "Unknown Origin"))); } function verbose($test) { if (!empty($test['HTTP_REFERER'])) { return $test['HTTP_REFERER']; } if (!empty($test['HTTP_ORIGIN'])) { return $test['HTTP_ORIGIN']; } if (!empty($test['ORIGIN'])) { return $test['ORIGIN']; } return 'Unknown Origin'; } echo ternary($test); echo \PHP_EOL; echo verbose($test); echo \PHP_EOL . '---' . \PHP_EOL; $test = [ 'HTTP_ORIGIN' => 'http_origin' ]; echo ternary($test); echo \PHP_EOL; echo verbose($test); echo \PHP_EOL . '---' . \PHP_EOL; $test = [ 'ORIGIN' => 'origin' ]; echo ternary($test); echo \PHP_EOL; echo verbose($test);
Output for git.master, git.master_jit, rfc.property-hooks
http_referer http_referer --- http_origin http_origin --- origin origin

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:
167.59 ms | 405 KiB | 5 Q