3v4l.org

run code in 300+ PHP versions simultaneously
<?php $var = ['someKey' => 'someValue']; echo $var['someKey']; $wasSet = isset($var['aKey']); if ($wasSet) { echo "was set"; } else { echo "was not set"; } $possibleVar = $var['aKey']; if ($possibleVar) { echo "possible var: $possibleVar"; } else { echo "possible var is false: $possibleVar"; } function testIsSet($arg, $key) { if (isset($arg[$key])) { return $arg[$key]; } return "Default value"; } $retrievedValue = testIsSet($var, 'aKey'); echo "\n\nRetrieved value is $retrievedValue\n";
Output for git.master, git.master_jit, rfc.property-hooks
someValuewas not set Warning: Undefined array key "aKey" in /in/rfLbK on line 15 possible var is false: Retrieved value is Default value

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