3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $input = []; $s = microtime(true); for ($i = 0; $i < 100000; $i++) $name = $input['name'] ?? 'John'; var_dump(microtime(true)-$s); $s = microtime(true); for ($i = 0; $i < 100000; $i++) $name = isset($input['name']) ? $input['name']:'John'; var_dump(microtime(true)-$s);
based on KWWKn
Output for 7.1.0
float(0.0037097930908203) float(0.0031900405883789)
Output for 7.0.14
float(0.0038001537322998) float(0.0029900074005127)
Output for 7.0.6
float(0.0033571720123291) float(0.0028409957885742)
Output for 7.0.5
float(0.0022869110107422) float(0.0017862319946289)
Output for 7.0.4
float(0.0024168491363525) float(0.0019869804382324)
Output for 7.0.3
float(0.0022430419921875) float(0.0019629001617432)
Output for 7.0.2
float(0.0020978450775146) float(0.0017290115356445)
Output for 7.0.1
float(0.0022780895233154) float(0.0017910003662109)
Output for 7.0.0
float(0.0028789043426514) float(0.0023629665374756)
Output for hhvm-3.12.0
float(0.0087101459503174) float(0.0072259902954102)
Output for hhvm-3.10.0
Fatal error: syntax error, unexpected '?' in /in/F8I2T on line 8
Process exited with code 255.
Output for 5.4.0 - 5.6.28
Parse error: syntax error, unexpected '?' in /in/F8I2T on line 8
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/F8I2T on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/F8I2T on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/F8I2T on line 3
Process exited with code 255.