3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function realValue($value) { if ( is_string($value) && strpos($value, '"SuperClosure\Serialize"') !== false ){ return 'closure!'; } return $value; } function rand_string($len) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; $size = strlen($chars); $str = null; for ($i = 0; $i < $len; $i++) { $str .= $chars[ rand( 0, $size - 1 ) ]; } return $str; } $records = []; for ($i = 1; $i <= 2000; $i++) { $records[$i] = rand_string(1000); } // Ignore above, just generate a random string with 20,000 records. $read_value = null; $realValue_bench_start = microtime(true); foreach ($records as $record) { $read_value = realValue($record); } $realValue_bench_end = microtime(true); $directAccess_bench_start = microtime(true); foreach ($records as $record) { $read_value = $record; } $directAccess_bench_end = microtime(true); $diffRealValue = $realValue_bench_end - $realValue_bench_start; $diffDirectAccess = $directAccess_bench_end - $directAccess_bench_start; echo("readValue time: $diffRealValue"); echo("\ndirectAccess time: $diffDirectAccess"); echo("\ndifference:" . ($diffRealValue - $diffDirectAccess));
Output for 7.2.4
readValue time: 0.00059294700622559 directAccess time: 4.4107437133789E-5 difference:0.0005488395690918
Output for 7.2.3
readValue time: 0.00057101249694824 directAccess time: 4.9829483032227E-5 difference:0.00052118301391602
Output for 7.2.2
readValue time: 0.00045108795166016 directAccess time: 3.8862228393555E-5 difference:0.0004122257232666
Output for 7.2.1
readValue time: 0.00053119659423828 directAccess time: 4.2915344238281E-5 difference:0.00048828125
Output for 7.2.0
readValue time: 0.00046801567077637 directAccess time: 3.7908554077148E-5 difference:0.00043010711669922
Output for 7.1.16
readValue time: 0.00050902366638184 directAccess time: 4.0054321289062E-5 difference:0.00046896934509277
Output for 7.1.15
readValue time: 0.00069594383239746 directAccess time: 7.2956085205078E-5 difference:0.00062298774719238
Output for 7.1.14
readValue time: 0.00046706199645996 directAccess time: 4.887580871582E-5 difference:0.00041818618774414
Output for 7.1.13
readValue time: 0.00051212310791016 directAccess time: 3.6954879760742E-5 difference:0.00047516822814941
Output for 7.1.10, 7.1.12
readValue time: 0.00048995018005371 directAccess time: 3.9100646972656E-5 difference:0.00045084953308105
Output for 7.1.11
readValue time: 0.00042200088500977 directAccess time: 4.4107437133789E-5 difference:0.00037789344787598
Output for 7.1.9
readValue time: 0.00045108795166016 directAccess time: 4.4107437133789E-5 difference:0.00040698051452637
Output for 7.1.8
readValue time: 0.00050806999206543 directAccess time: 4.7922134399414E-5 difference:0.00046014785766602
Output for 7.1.7
readValue time: 0.00040984153747559 directAccess time: 3.814697265625E-5 difference:0.00037169456481934
Output for 7.1.6
readValue time: 0.0004119873046875 directAccess time: 3.9100646972656E-5 difference:0.00037288665771484
Output for 7.1.5
readValue time: 0.00047802925109863 directAccess time: 4.2915344238281E-5 difference:0.00043511390686035
Output for 7.1.4
readValue time: 0.0047369003295898 directAccess time: 5.1021575927734E-5 difference:0.0046858787536621
Output for 7.1.3
readValue time: 0.0005347728729248 directAccess time: 4.8160552978516E-5 difference:0.00048661231994629
Output for 7.1.2
readValue time: 0.00051093101501465 directAccess time: 3.814697265625E-5 difference:0.0004727840423584
Output for 7.1.1
readValue time: 0.0005030632019043 directAccess time: 4.0054321289062E-5 difference:0.00046300888061523
Output for 7.1.0
readValue time: 0.0004270076751709 directAccess time: 4.3869018554688E-5 difference:0.00038313865661621
Output for hhvm-3.22.0
readValue time: 0.00098419189453125 directAccess time: 0.00011897087097168 difference:0.00086522102355957
Output for hhvm-3.21.3
readValue time: 0.00095534324645996 directAccess time: 0.00012850761413574 difference:0.00082683563232422
Output for hhvm-3.18.5
readValue time: 0.00080490112304688 directAccess time: 0.0001060962677002 difference:0.00069880485534668
Output for 5.6.30
readValue time: 0.0011379718780518 directAccess time: 8.2969665527344E-5 difference:0.0010550022125244
Output for 5.6.29
readValue time: 0.0011241436004639 directAccess time: 8.9883804321289E-5 difference:0.0010342597961426
Output for 5.6.28
readValue time: 0.0011489391326904 directAccess time: 9.0122222900391E-5 difference:0.00105881690979
Output for 5.6.27
readValue time: 0.0011789798736572 directAccess time: 0.00010895729064941 difference:0.0010700225830078
Output for 5.6.26
readValue time: 0.0012490749359131 directAccess time: 0.0001370906829834 difference:0.0011119842529297
Output for 5.6.25
readValue time: 0.0011541843414307 directAccess time: 8.9883804321289E-5 difference:0.0010643005371094
Output for 5.6.24
readValue time: 0.0011730194091797 directAccess time: 8.4161758422852E-5 difference:0.0010888576507568
Output for 5.6.23
readValue time: 0.0011019706726074 directAccess time: 0.00010514259338379 difference:0.00099682807922363
Output for 5.6.22
readValue time: 0.0012168884277344 directAccess time: 8.082389831543E-5 difference:0.0011360645294189
Output for 5.6.21
readValue time: 0.0010950565338135 directAccess time: 8.4877014160156E-5 difference:0.0010101795196533
Output for 5.6.20
readValue time: 0.0012080669403076 directAccess time: 8.392333984375E-5 difference:0.0011241436004639
Output for 5.6.19
readValue time: 0.0011768341064453 directAccess time: 8.8930130004883E-5 difference:0.0010879039764404
Output for 5.6.18
readValue time: 0.0011670589447021 directAccess time: 8.2969665527344E-5 difference:0.0010840892791748
Output for 5.6.17
readValue time: 0.0010581016540527 directAccess time: 8.702278137207E-5 difference:0.00097107887268066
Output for 5.6.16
readValue time: 0.0010881423950195 directAccess time: 9.7036361694336E-5 difference:0.0009911060333252
Output for 5.6.15
readValue time: 0.0011119842529297 directAccess time: 8.2015991210938E-5 difference:0.0010299682617188
Output for 5.6.14
readValue time: 0.001115083694458 directAccess time: 8.8930130004883E-5 difference:0.0010261535644531
Output for 5.6.13
readValue time: 0.00118088722229 directAccess time: 9.2983245849609E-5 difference:0.0010879039764404
Output for 5.6.12
readValue time: 0.0010759830474854 directAccess time: 8.8930130004883E-5 difference:0.00098705291748047
Output for 5.6.11
readValue time: 0.0011498928070068 directAccess time: 8.0108642578125E-5 difference:0.0010697841644287
Output for 5.6.10
readValue time: 0.0014479160308838 directAccess time: 0.00010013580322266 difference:0.0013477802276611
Output for 5.6.9
readValue time: 0.0013089179992676 directAccess time: 0.00012302398681641 difference:0.0011858940124512
Output for 5.6.8
readValue time: 0.0017101764678955 directAccess time: 0.00017189979553223 difference:0.0015382766723633
Output for 5.6.7
readValue time: 0.0011861324310303 directAccess time: 8.392333984375E-5 difference:0.0011022090911865
Output for 5.6.6
readValue time: 0.001209020614624 directAccess time: 9.1075897216797E-5 difference:0.0011179447174072
Output for 5.6.5
readValue time: 0.001521110534668 directAccess time: 9.2983245849609E-5 difference:0.0014281272888184
Output for 5.6.4
readValue time: 0.001244068145752 directAccess time: 8.9883804321289E-5 difference:0.0011541843414307
Output for 5.6.3
readValue time: 0.0011801719665527 directAccess time: 9.7036361694336E-5 difference:0.0010831356048584
Output for 5.6.2
readValue time: 0.0013139247894287 directAccess time: 9.3936920166016E-5 difference:0.0012199878692627
Output for 5.6.1
readValue time: 0.0011780261993408 directAccess time: 8.702278137207E-5 difference:0.0010910034179688
Output for 5.6.0
readValue time: 0.0014119148254395 directAccess time: 0.00010418891906738 difference:0.0013077259063721