3v4l.org

run code in 200+ 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.2.0
float(0.0030200481414795) float(0.0026259422302246)
Output for 7.1.7
float(0.0022368431091309) float(0.0017919540405273)
Output for 7.1.6
float(0.0048470497131348) float(0.0036008358001709)
Output for 7.1.5
float(0.0056781768798828) float(0.0045781135559082)
Output for 7.1.0
float(0.0037097930908203) float(0.0031900405883789)
Output for 7.0.20
float(0.0030720233917236) float(0.0024051666259766)
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 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.