3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php    $START = time();    $foo['bar'] = "test";    for ($i = 0; $i < 10000000; ++$i) {        if ($foo['bar'] == "test") {            $j = 0;        }    }    $END = time() - $START;    print "Array took $END seconds\n";    $START = time();    $testvar = $foo['bar'];    for ($i = 0; $i < 10000000; ++$i) {        if ($testvar == "test") {            $j = 0;        }    }    $END = time() - $START;    print "Var took $END seconds\n";?>
Output for 5.3.0 - 5.4.32
<?php    $START = time();    $foo['bar'] = "test";    for ($i = 0; $i < 10000000; ++$i) {        if ($foo['bar'] == "test") {            $j = 0;        }    }    $END = time() - $START;    print "Array took $END seconds\n";    $START = time();    $testvar = $foo['bar'];    for ($i = 0; $i < 10000000; ++$i) {        if ($testvar == "test") {            $j = 0;        }    }    $END = time() - $START;    print "Var took $END seconds\n";?>