3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<? $count = 1000000; function t($a, $b) { return ($a + $b) * ($a - $b); } class test { public static function staticTest($a, $b) { return ($a + $b) * ($a - $b); } } $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { $res = ($a + $b) * ($a - $b); $a = $a + 2; $b = $b + 1; } echo '$a = $a + 1: ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { $a = t($a, $b); $a = $a + 2; $b = $b + 1; } echo '$a = t($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { test::staticTest($a, $b); $a = $a + 2; $b = $b + 1; } echo 'test::staticTest($a): ', "\t\t", (microtime(true) - $time), PHP_EOL;
Output for 7.1.7
$a = $a + 1: 0.039924144744873 $a = t($a): 0.059132814407349 test::staticTest($a): 0.051002025604248
Output for 7.1.6
$a = $a + 1: 0.026646137237549 $a = t($a): 0.043761968612671 test::staticTest($a): 0.042075872421265
Output for 7.1.5
$a = $a + 1: 0.052041053771973 $a = t($a): 0.067591905593872 test::staticTest($a): 0.053238868713379
Output for 7.1.0
$a = $a + 1: 0.066233158111572 $a = t($a): 0.080884218215942 test::staticTest($a): 0.069623947143555
Output for 7.0.20
$a = $a + 1: 0.025815010070801 $a = t($a): 0.05454683303833 test::staticTest($a): 0.055243015289307
Output for 7.0.14
$a = $a + 1: 0.060715913772583 $a = t($a): 0.056484937667847 test::staticTest($a): 0.061552047729492
Output for 7.0.6
$a = $a + 1: 0.03827691078186 $a = t($a): 0.047583818435669 test::staticTest($a): 0.04781699180603
Output for 7.0.5
$a = $a + 1: 0.033655881881714 $a = t($a): 0.045423030853271 test::staticTest($a): 0.046872854232788
Output for 7.0.4
$a = $a + 1: 0.031853914260864 $a = t($a): 0.058650016784668 test::staticTest($a): 0.072404861450195
Output for 7.0.3
$a = $a + 1: 0.036024808883667 $a = t($a): 0.052055835723877 test::staticTest($a): 0.047398090362549
Output for 7.0.2
$a = $a + 1: 0.029778957366943 $a = t($a): 0.050076961517334 test::staticTest($a): 0.054404020309448
Output for 7.0.1
$a = $a + 1: 0.027382135391235 $a = t($a): 0.044647932052612 test::staticTest($a): 0.04714298248291
Output for 7.0.0
$a = $a + 1: 0.028402090072632 $a = t($a): 0.0521559715271 test::staticTest($a): 0.0522301197052
Output for 5.6.28
$a = $a + 1: 0.10799503326416 $a = t($a): 0.18032002449036 test::staticTest($a): 0.14229989051819
Output for 5.6.21
$a = $a + 1: 0.053951025009155 $a = t($a): 0.1964590549469 test::staticTest($a): 0.12642598152161
Output for 5.6.20
$a = $a + 1: 0.067942142486572 $a = t($a): 0.24274706840515 test::staticTest($a): 0.1550509929657
Output for 5.6.19
$a = $a + 1: 0.056246995925903 $a = t($a): 0.14543795585632 test::staticTest($a): 0.12754011154175
Output for 5.6.18
$a = $a + 1: 0.055341958999634 $a = t($a): 0.14850211143494 test::staticTest($a): 0.13455700874329
Output for 5.6.17
$a = $a + 1: 0.053065061569214 $a = t($a): 0.19074320793152 test::staticTest($a): 0.12569308280945
Output for 5.6.16
$a = $a + 1: 0.065402030944824 $a = t($a): 0.19971108436584 test::staticTest($a): 0.14166188240051
Output for 5.6.15
$a = $a + 1: 0.061444044113159 $a = t($a): 0.19570803642273 test::staticTest($a): 0.12686014175415
Output for 5.6.14
$a = $a + 1: 0.058074951171875 $a = t($a): 0.1971230506897 test::staticTest($a): 0.12934994697571
Output for 5.6.13
$a = $a + 1: 0.070624113082886 $a = t($a): 0.19854092597961 test::staticTest($a): 0.1298131942749
Output for 5.6.12
$a = $a + 1: 0.05305814743042 $a = t($a): 0.19316816329956 test::staticTest($a): 0.12824702262878
Output for 5.6.11
$a = $a + 1: 0.056419849395752 $a = t($a): 0.20088601112366 test::staticTest($a): 0.133455991745
Output for 5.6.10
$a = $a + 1: 0.062186002731323 $a = t($a): 0.23061895370483 test::staticTest($a): 0.15982699394226
Output for 5.6.9
$a = $a + 1: 0.070658922195435 $a = t($a): 0.19794988632202 test::staticTest($a): 0.13039708137512
Output for 5.6.8
$a = $a + 1: 0.07155704498291 $a = t($a): 0.19770193099976 test::staticTest($a): 0.13079905509949
Output for 5.5.35
$a = $a + 1: 0.054075002670288 $a = t($a): 0.20135807991028 test::staticTest($a): 0.12963581085205
Output for 5.5.34
$a = $a + 1: 0.070873022079468 $a = t($a): 0.20114612579346 test::staticTest($a): 0.1292040348053
Output for 5.5.33
$a = $a + 1: 0.069047927856445 $a = t($a): 0.14398407936096 test::staticTest($a): 0.12546706199646
Output for 5.5.32
$a = $a + 1: 0.053045988082886 $a = t($a): 0.19746899604797 test::staticTest($a): 0.12344789505005
Output for 5.5.31
$a = $a + 1: 0.068962097167969 $a = t($a): 0.20155000686646 test::staticTest($a): 0.13050198554993
Output for 5.5.30
$a = $a + 1: 0.06470799446106 $a = t($a): 0.19923710823059 test::staticTest($a): 0.12692403793335
Output for 5.5.29
$a = $a + 1: 0.072031021118164 $a = t($a): 0.20088982582092 test::staticTest($a): 0.12698984146118
Output for 5.5.28
$a = $a + 1: 0.059540987014771 $a = t($a): 0.20073390007019 test::staticTest($a): 0.12966799736023
Output for 5.5.27
$a = $a + 1: 0.072015047073364 $a = t($a): 0.20189595222473 test::staticTest($a): 0.13225388526917
Output for 5.5.26
$a = $a + 1: 0.072602987289429 $a = t($a): 0.19531607627869 test::staticTest($a): 0.12646007537842
Output for 5.5.25
$a = $a + 1: 0.054049015045166 $a = t($a): 0.19840407371521 test::staticTest($a): 0.12316489219666
Output for 5.5.24
$a = $a + 1: 0.073013782501221 $a = t($a): 0.197594165802 test::staticTest($a): 0.12316584587097
Output for 5.4.45
$a = $a + 1: 0.05248498916626 $a = t($a): 0.14064598083496 test::staticTest($a): 0.1181628704071
Output for 5.4.44
$a = $a + 1: 0.050917148590088 $a = t($a): 0.13629794120789 test::staticTest($a): 0.1183910369873
Output for 5.4.43
$a = $a + 1: 0.050980806350708 $a = t($a): 0.13535809516907 test::staticTest($a): 0.11865901947021
Output for 5.4.42
$a = $a + 1: 0.050601005554199 $a = t($a): 0.13764309883118 test::staticTest($a): 0.11624717712402
Output for 5.4.41
$a = $a + 1: 0.052044153213501 $a = t($a): 0.13841700553894 test::staticTest($a): 0.12306118011475
Output for 5.4.40
$a = $a + 1: 0.052095174789429 $a = t($a): 0.13872385025024 test::staticTest($a): 0.12353420257568
Output for 5.4.39
$a = $a + 1: 0.051730871200562 $a = t($a): 0.13960099220276 test::staticTest($a): 0.14027810096741
Output for 5.4.38
$a = $a + 1: 0.07410717010498 $a = t($a): 0.19700193405151 test::staticTest($a): 0.13592505455017
Output for 5.4.37
$a = $a + 1: 0.052291870117188 $a = t($a): 0.14471793174744 test::staticTest($a): 0.12820816040039
Output for 5.4.36
$a = $a + 1: 0.052349090576172 $a = t($a): 0.13774490356445 test::staticTest($a): 0.11846685409546
Output for 5.4.35
$a = $a + 1: 0.052447080612183 $a = t($a): 0.13980913162231 test::staticTest($a): 0.12530303001404
Output for 5.4.34
$a = $a + 1: 0.052171230316162 $a = t($a): 0.14233994483948 test::staticTest($a): 0.12837505340576
Output for 5.4.32
$a = $a + 1: 0.070382118225098 $a = t($a): 0.14351892471313 test::staticTest($a): 0.12059617042542
Output for 5.4.31
$a = $a + 1: 0.052252054214478 $a = t($a): 0.13951587677002 test::staticTest($a): 0.11802196502686
Output for 5.4.30
$a = $a + 1: 0.050534009933472 $a = t($a): 0.13855409622192 test::staticTest($a): 0.12644290924072
Output for 5.4.29
$a = $a + 1: 0.052237987518311 $a = t($a): 0.13785099983215 test::staticTest($a): 0.12138295173645
Output for 5.4.28
$a = $a + 1: 0.052042961120605 $a = t($a): 0.13726401329041 test::staticTest($a): 0.11999297142029
Output for 5.4.27
$a = $a + 1: 0.052771091461182 $a = t($a): 0.13783383369446 test::staticTest($a): 0.1176700592041
Output for 5.4.26
$a = $a + 1: 0.069111824035645 $a = t($a): 0.14094996452332 test::staticTest($a): 0.11990189552307
Output for 5.4.25
$a = $a + 1: 0.053719997406006 $a = t($a): 0.13815808296204 test::staticTest($a): 0.12378811836243
Output for 5.4.24
$a = $a + 1: 0.050131797790527 $a = t($a): 0.13229012489319 test::staticTest($a): 0.11748099327087
Output for 5.4.23
$a = $a + 1: 0.052570104598999 $a = t($a): 0.136873960495 test::staticTest($a): 0.12177705764771
Output for 5.4.22
$a = $a + 1: 0.050750970840454 $a = t($a): 0.13329696655273 test::staticTest($a): 0.11694097518921
Output for 5.4.21
$a = $a + 1: 0.051550149917603 $a = t($a): 0.13394999504089 test::staticTest($a): 0.11542105674744
Output for 5.4.20
$a = $a + 1: 0.05321192741394 $a = t($a): 0.13888788223267 test::staticTest($a): 0.12204694747925
Output for 5.4.19
$a = $a + 1: 0.052787780761719 $a = t($a): 0.13693809509277 test::staticTest($a): 0.12306785583496
Output for 5.4.18
$a = $a + 1: 0.064678192138672 $a = t($a): 0.13649415969849 test::staticTest($a): 0.12042212486267
Output for 5.4.17
$a = $a + 1: 0.050650835037231 $a = t($a): 0.13603806495667 test::staticTest($a): 0.11993288993835
Output for 5.4.16
$a = $a + 1: 0.050917863845825 $a = t($a): 0.13621497154236 test::staticTest($a): 0.11949610710144
Output for 5.4.15
$a = $a + 1: 0.055206775665283 $a = t($a): 0.1525559425354 test::staticTest($a): 0.14270687103271
Output for 5.4.14
$a = $a + 1: 0.050423860549927 $a = t($a): 0.13962197303772 test::staticTest($a): 0.11977100372314
Output for 5.4.13
$a = $a + 1: 0.050856828689575 $a = t($a): 0.1383011341095 test::staticTest($a): 0.12024784088135
Output for 5.4.12
$a = $a + 1: 0.053023099899292 $a = t($a): 0.14058399200439 test::staticTest($a): 0.12026405334473
Output for 5.4.11
$a = $a + 1: 0.051703929901123 $a = t($a): 0.13545989990234 test::staticTest($a): 0.11916494369507
Output for 5.4.10
$a = $a + 1: 0.052021980285645 $a = t($a): 0.13537502288818 test::staticTest($a): 0.11706495285034
Output for 5.4.9
$a = $a + 1: 0.052582025527954 $a = t($a): 0.1362931728363 test::staticTest($a): 0.11822700500488
Output for 5.4.8
$a = $a + 1: 0.053097009658813 $a = t($a): 0.13657903671265 test::staticTest($a): 0.11957097053528
Output for 5.4.7
$a = $a + 1: 0.052680969238281 $a = t($a): 0.1385669708252 test::staticTest($a): 0.12024402618408
Output for 5.4.6
$a = $a + 1: 0.054112911224365 $a = t($a): 0.13972878456116 test::staticTest($a): 0.1221170425415
Output for 5.4.5
$a = $a + 1: 0.052912950515747 $a = t($a): 0.13981699943542 test::staticTest($a): 0.1231951713562
Output for 5.4.4
$a = $a + 1: 0.052616834640503 $a = t($a): 0.13750886917114 test::staticTest($a): 0.11997294425964
Output for 5.4.3
$a = $a + 1: 0.053230047225952 $a = t($a): 0.13651490211487 test::staticTest($a): 0.11741995811462
Output for 5.4.2
$a = $a + 1: 0.05251407623291 $a = t($a): 0.13574004173279 test::staticTest($a): 0.11777496337891
Output for 5.4.1
$a = $a + 1: 0.053929805755615 $a = t($a): 0.14043593406677 test::staticTest($a): 0.12043809890747
Output for 5.4.0
$a = $a + 1: 0.078970909118652 $a = t($a): 0.21198701858521 test::staticTest($a): 0.1882598400116
Output for 4.3.0 - 5.3.29
<? $count = 1000000; function t($a, $b) { return ($a + $b) * ($a - $b); } class test { public static function staticTest($a, $b) { return ($a + $b) * ($a - $b); } } $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { $res = ($a + $b) * ($a - $b); $a = $a + 2; $b = $b + 1; } echo '$a = $a + 1: ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { $a = t($a, $b); $a = $a + 2; $b = $b + 1; } echo '$a = t($a): ', "\t\t\t", (microtime(true) - $time), PHP_EOL; $time = microtime(true); $i = 0; $a = 1; $b = 1; while ($i++ < $count) { test::staticTest($a, $b); $a = $a + 2; $b = $b + 1; } echo 'test::staticTest($a): ', "\t\t", (microtime(true) - $time), PHP_EOL;