3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $attempts = 100000; $test = 1; if ($test == 1) { $start = microtime(true); for ($i = 0; $i < $attempts; $i++) { $user = array( 'id' => 27, 'name' => 'Pepe' ); } $end = microtime(true); echo 'Array: ' . ($end - $start) . " <br />\n"; } if ($test == 2) { $start = microtime(true); for ($i = 0; $i < $attempts; $i++) { $user = new stdClass(); $user->id = 27; $user->name = 'Pepe'; } $end = microtime(true); echo 'Object: ' . ($end - $start) . " <br />\n"; } if ($test == 3) { $start = microtime(true); for ($i = 0; $i < $attempts; $i++) { $user = (object) array( 'id' => 27, 'name' => 'Pepe' ); } $end = microtime(true); echo 'Cast: ' . ($end - $start) . " <br />\n"; }
Output for 7.1.0
Array: 0.0023040771484375 <br />
Output for 7.0.14
Array: 0.010380983352661 <br />
Output for 7.0.6
Array: 0.0068380832672119 <br />
Output for 7.0.5
Array: 0.0059051513671875 <br />
Output for 7.0.4
Array: 0.0068731307983398 <br />
Output for 7.0.3
Array: 0.0063700675964355 <br />
Output for 7.0.2
Array: 0.0046138763427734 <br />
Output for 7.0.1
Array: 0.0045828819274902 <br />
Output for 7.0.0
Array: 0.0068769454956055 <br />
Output for hhvm-3.12.0
Array: 0.006026029586792 <br />
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.6.28
Array: 0.027570009231567 <br />
Output for 5.6.21
Array: 0.019413948059082 <br />
Output for 5.6.20
Array: 0.013014078140259 <br />
Output for 5.6.19
Array: 0.017800807952881 <br />
Output for 5.6.18
Array: 0.012628078460693 <br />
Output for 5.6.17
Array: 0.017728090286255 <br />
Output for 5.6.16
Array: 0.013324022293091 <br />
Output for 5.6.15
Array: 0.017594814300537 <br />
Output for 5.6.14
Array: 0.020143985748291 <br />
Output for 5.6.13
Array: 0.014851093292236 <br />
Output for 5.6.12
Array: 0.018764019012451 <br />
Output for 5.6.11
Array: 0.013256072998047 <br />
Output for 5.6.10
Array: 0.016855955123901 <br />
Output for 5.6.9
Array: 0.017423868179321 <br />
Output for 5.6.8
Array: 0.019505977630615 <br />
Output for 5.6.7
Array: 0.017616033554077 <br />
Output for 5.5.35
Array: 0.018692016601562 <br />
Output for 5.5.34
Array: 0.0138840675354 <br />
Output for 5.5.33
Array: 0.019067049026489 <br />
Output for 5.5.32
Array: 0.016586065292358 <br />
Output for 5.5.31
Array: 0.013062000274658 <br />
Output for 5.5.30
Array: 0.015029907226562 <br />
Output for 5.5.29
Array: 0.014134883880615 <br />
Output for 5.5.28
Array: 0.020278930664062 <br />
Output for 5.5.27
Array: 0.017838001251221 <br />
Output for 5.5.26
Array: 0.019552946090698 <br />
Output for 5.5.25
Array: 0.019083976745605 <br />
Output for 5.5.24
Array: 0.018979072570801 <br />
Output for 5.4.45
Array: 0.012891054153442 <br />
Output for 5.4.44
Array: 0.024196863174438 <br />
Output for 5.4.43
Array: 0.020111083984375 <br />
Output for 5.4.42
Array: 0.02112603187561 <br />
Output for 5.4.41
Array: 0.023214817047119 <br />
Output for 5.4.40
Array: 0.01978588104248 <br />
Output for 5.4.39
Array: 0.019432067871094 <br />
Output for 5.4.38
Array: 0.019438028335571 <br />
Output for 5.4.37
Array: 0.028493881225586 <br />
Output for 5.4.36
Array: 0.026524782180786 <br />
Output for 5.4.35
Array: 0.015361070632935 <br />
Output for 5.4.34
Array: 0.015251874923706 <br />
Output for 5.4.32
Array: 0.013707876205444 <br />
Output for 5.4.31
Array: 0.014125108718872 <br />
Output for 5.4.30
Array: 0.031270027160645 <br />
Output for 5.4.29
Array: 0.030275821685791 <br />
Output for 5.4.28
Array: 0.033054113388062 <br />
Output for 5.4.27
Array: 0.030105829238892 <br />
Output for 5.4.26
Array: 0.028120994567871 <br />
Output for 5.4.25
Array: 0.025969982147217 <br />
Output for 5.4.24
Array: 0.029430866241455 <br />
Output for 5.4.23
Array: 0.028162002563477 <br />
Output for 5.4.22
Array: 0.028625965118408 <br />
Output for 5.4.21
Array: 0.016554117202759 <br />
Output for 5.4.20
Array: 0.01556396484375 <br />
Output for 5.4.19
Array: 0.018547058105469 <br />
Output for 5.4.18
Array: 0.018937110900879 <br />
Output for 5.4.17
Array: 0.015643119812012 <br />
Output for 5.4.16
Array: 0.015850067138672 <br />
Output for 5.4.15
Array: 0.017915010452271 <br />
Output for 5.4.14
Array: 0.015388011932373 <br />
Output for 5.4.13
Array: 0.016874074935913 <br />
Output for 5.4.12
Array: 0.017110824584961 <br />
Output for 5.4.11
Array: 0.016183137893677 <br />
Output for 5.4.10
Array: 0.015703201293945 <br />
Output for 5.4.9
Array: 0.01636004447937 <br />
Output for 5.4.8
Array: 0.016991853713989 <br />
Output for 5.4.7
Array: 0.01529598236084 <br />
Output for 5.4.6
Array: 0.018125057220459 <br />
Output for 5.4.5
Array: 0.015616893768311 <br />
Output for 5.4.4
Array: 0.015996932983398 <br />
Output for 5.4.3
Array: 0.015744924545288 <br />
Output for 5.4.2
Array: 0.018671989440918 <br />
Output for 5.4.1
Array: 0.02592396736145 <br />
Output for 5.4.0
Array: 0.030951976776123 <br />
Output for 5.3.29
Array: 0.017518043518066 <br />
Output for 5.3.28
Array: 0.03757119178772 <br />
Output for 5.3.27
Array: 0.029953002929688 <br />
Output for 5.3.26
Array: 0.017279863357544 <br />
Output for 5.3.25
Array: 0.018083095550537 <br />
Output for 5.3.24
Array: 0.018312931060791 <br />
Output for 5.3.23
Array: 0.018110036849976 <br />
Output for 5.3.22
Array: 0.023573875427246 <br />
Output for 5.3.21
Array: 0.023629903793335 <br />
Output for 5.3.20
Array: 0.026710033416748 <br />
Output for 5.3.19
Array: 0.021373987197876 <br />
Output for 5.3.18
Array: 0.018835067749023 <br />
Output for 5.3.17
Array: 0.020370006561279 <br />
Output for 5.3.16
Array: 0.020659923553467 <br />
Output for 5.3.15
Array: 0.019094944000244 <br />
Output for 5.3.14
Array: 0.028341054916382 <br />
Output for 5.3.13
Array: 0.025892972946167 <br />
Output for 5.3.12
Array: 0.021102905273438 <br />
Output for 5.3.11
Array: 0.021832942962646 <br />
Output for 5.3.10
Array: 0.029785871505737 <br />
Output for 5.3.9
Array: 0.020457029342651 <br />
Output for 5.3.8
Array: 0.026421070098877 <br />
Output for 5.3.7
Array: 0.018532991409302 <br />
Output for 5.3.6
Array: 0.019036054611206 <br />
Output for 5.3.5
Array: 0.028465986251831 <br />
Output for 5.3.4
Array: 0.01935601234436 <br />
Output for 5.3.3
Array: 0.019844055175781 <br />
Output for 5.3.2
Array: 0.027339935302734 <br />
Output for 5.3.1
Array: 0.020730972290039 <br />
Output for 5.3.0
Array: 0.018079042434692 <br />
Output for 5.2.17
Array: 0.024792194366455 <br />
Output for 5.2.16
Array: 0.026005983352661 <br />
Output for 5.2.15
Array: 0.027017116546631 <br />
Output for 5.2.14
Array: 0.028547048568726 <br />
Output for 5.2.13
Array: 0.038784980773926 <br />
Output for 5.2.12
Array: 0.025908946990967 <br />
Output for 5.2.11
Array: 0.023425102233887 <br />
Output for 5.2.10
Array: 0.029217958450317 <br />
Output for 5.2.9
Array: 0.026047945022583 <br />
Output for 5.2.8
Array: 0.021607875823975 <br />
Output for 5.2.7
Array: 0.025349855422974 <br />
Output for 5.2.6
Array: 0.024385929107666 <br />
Output for 5.2.5
Array: 0.0258948802948 <br />
Output for 5.2.4
Array: 0.023969173431396 <br />
Output for 5.2.3
Array: 0.023852109909058 <br />
Output for 5.2.2
Array: 0.027590990066528 <br />
Output for 5.2.1
Array: 0.029458999633789 <br />
Output for 5.2.0
Array: 0.024441003799438 <br />
Output for 5.1.6
Array: 0.038990020751953 <br />
Output for 5.1.5
Array: 0.041254997253418 <br />
Output for 5.1.4
Array: 0.03982400894165 <br />
Output for 5.1.3
Array: 0.025018930435181 <br />
Output for 5.1.2
Array: 0.020822048187256 <br />
Output for 5.1.1
Array: 0.033486127853394 <br />
Output for 5.1.0
Array: 0.037302017211914 <br />
Output for 5.0.5
Array: 0.062304019927979 <br />
Output for 5.0.4
Array: 0.069720983505249 <br />
Output for 5.0.3
Array: 0.049569129943848 <br />
Output for 5.0.2
Array: 0.047873020172119 <br />
Output for 5.0.1
Array: 0.041683912277222 <br />
Output for 5.0.0
Array: 0.044414043426514 <br />
Output for 4.4.9
Array: -0.952764 <br />
Output for 4.4.8
Array: 0.044914 <br />
Output for 4.4.7
Array: 0.0411 <br />
Output for 4.4.6
Array: 0.045619 <br />
Output for 4.4.5
Array: 0.057376 <br />
Output for 4.4.4
Array: 0.045595 <br />
Output for 4.4.3
Array: 0.049279 <br />
Output for 4.4.2
Array: 0.047062 <br />
Output for 4.4.1
Array: 0.044871 <br />
Output for 4.4.0
Array: 0.043439 <br />
Output for 4.3.11
Array: 0.041047 <br />
Output for 4.3.10
Array: 0.044635 <br />
Output for 4.3.9
Array: 0.046339 <br />
Output for 4.3.8
Array: 0.043003 <br />
Output for 4.3.7
Array: 0.045479 <br />
Output for 4.3.6
Array: 0.043101 <br />
Output for 4.3.5
Array: 0.040341 <br />
Output for 4.3.4
Array: 0.039521 <br />
Output for 4.3.3
Array: 0.039497 <br />
Output for 4.3.2
Array: 0.036994 <br />
Output for 4.3.1
Array: 0.040205 <br />
Output for 4.3.0
Array: 0.037571 <br />