3v4l.org

run code in 300+ PHP versions simultaneously
<?php function timeFunc($function, $runs) { $start = microtime(true); for ($i = 0; $i < $runs; $i++) { call_user_func($function); } return (microtime(true) - $start); } function Method1() { $foo = 'some words'; for ($i = 0; $i < 10000; $i++) { $t = "these are $foo"; } } function Method2() { $foo = 'some words'; for ($i = 0; $i < 10000; $i++) { $t = "these are {$foo}"; } } function Method3() { $foo = 'some words'; for ($i = 0; $i < 10000; $i++) { $t = "these are " . $foo; } } $a = timeFunc('Method1', 10); $b = timeFunc('Method2', 10); $c = timeFunc('Method3', 10); echo ($a + $b) / (2 * $a) . "\n"; echo ($a + $c) / (2 * $a) . "\n";

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
7.4.10.0070.03114.89
7.4.00.0070.02714.86
7.3.130.0070.03014.92
7.3.120.0030.03214.92
7.3.110.0100.02215.10
7.3.100.0070.02414.60
7.3.90.0100.02314.61
7.3.80.0060.01914.89
7.3.70.0040.02514.66
7.3.60.0000.02615.00
7.3.50.0030.02014.80
7.3.40.0030.02514.79
7.3.30.0100.01714.91
7.3.20.0030.02716.76
7.3.10.0030.02816.62
7.3.00.0110.02116.53
7.2.260.0140.02715.34
7.2.250.0110.02515.00
7.2.240.0000.03015.07
7.2.230.0100.01915.27
7.2.220.0000.03014.91
7.2.210.0070.02314.99
7.2.200.0000.02615.29
7.2.190.0070.02315.18
7.2.180.0070.02215.10
7.2.170.0100.01915.15
7.2.160.0030.02515.04
7.2.150.0070.01816.93
7.2.140.0150.01516.92
7.2.130.0120.02416.63
7.2.120.0070.02616.80
7.2.110.0100.02216.86
7.2.100.0130.02316.67
7.2.90.0130.02416.85
7.2.80.0110.02316.72
7.2.70.0100.02116.73
7.2.60.0080.02716.82
7.2.50.0060.02616.78
7.2.40.0150.02516.88
7.2.30.0120.02416.93
7.2.20.0110.02316.81
7.2.10.0110.02716.83
7.2.00.0120.02217.47
7.1.330.0130.02515.80
7.1.320.0060.03515.92
7.1.310.0000.04015.71
7.1.300.0070.03315.94
7.1.290.0100.03215.51
7.1.280.0100.02315.70
7.1.270.0030.03415.64
7.1.260.0000.04015.88
7.1.250.0070.03515.63
7.1.240.0100.02915.63
7.1.230.0090.02815.89
7.1.220.0070.03415.87
7.1.210.0030.03415.80
7.1.200.0100.03115.71
7.1.190.0030.03315.84
7.1.180.0100.03015.91
7.1.170.0000.03715.70
7.1.160.0030.03515.88
7.1.150.0030.03715.99
7.1.140.0030.03715.82
7.1.130.0030.03315.93
7.1.120.0000.04315.77
7.1.110.0030.03015.73
7.1.100.0030.03215.74
7.1.90.0100.03015.79
7.1.80.0060.03615.82
7.1.70.0020.02616.68
7.1.60.0080.03517.52
7.1.50.0030.03316.37
7.1.40.0070.03215.86
7.1.30.0070.03015.98
7.1.20.0060.03315.88
7.1.10.0070.03115.85
7.1.00.0070.06519.15
7.0.330.0100.02715.49
7.0.320.0100.03015.48
7.0.310.0110.02815.44
7.0.300.0060.03615.41
7.0.290.0000.03615.54
7.0.280.0040.03615.37
7.0.270.0000.03615.43
7.0.260.0040.03515.45
7.0.250.0000.03815.48
7.0.240.0060.03215.49
7.0.230.0040.03515.64
7.0.220.0000.04215.43
7.0.210.0060.02915.51
7.0.200.0030.02816.05
7.0.190.0030.03715.59
7.0.180.0030.03615.59
7.0.170.0030.03715.57
7.0.160.0070.03015.27
7.0.150.0060.02615.47
7.0.140.0050.05718.77
7.0.130.0030.03315.37
7.0.120.0030.03615.58
7.0.110.0040.03915.54
7.0.100.0200.05617.60
7.0.90.0240.06617.72
7.0.80.0180.05817.57
7.0.70.0230.06217.68
7.0.60.0200.06717.74
7.0.50.0200.06117.79
7.0.40.0030.06616.76
7.0.30.0050.06016.80
7.0.20.0080.05516.85
7.0.10.0030.06916.74
7.0.00.0020.06916.70
5.6.400.0000.06414.57
5.6.390.0030.06014.48
5.6.380.0030.05614.11
5.6.370.0030.06114.08
5.6.360.0100.05214.39
5.6.350.0030.05914.64
5.6.340.0030.06314.37
5.6.330.0000.05814.40
5.6.320.0030.05714.35
5.6.310.0070.05714.56
5.6.300.0100.05514.30
5.6.290.0070.05914.56
5.6.280.0080.08517.65
5.6.270.0030.06214.26
5.6.260.0030.06314.18
5.6.250.0100.08217.45
5.6.240.0020.08817.47
5.6.230.0100.06517.42
5.6.220.0070.08917.43
5.6.210.0050.08217.35
5.6.200.0100.08217.69
5.6.190.0100.05517.58
5.6.180.0110.06917.72
5.6.170.0050.06817.52
5.6.160.0100.08417.65
5.6.150.0080.06417.62
5.6.140.0070.07917.76
5.6.130.0070.08517.58
5.6.120.0130.07717.84
5.6.110.0070.06317.50
5.6.100.0100.08717.70
5.6.90.0120.07617.55
5.6.80.0120.07917.35
5.6.70.0020.07017.24
5.6.60.0080.06517.30
5.6.50.0030.08317.34
5.6.40.0050.05917.22
5.6.30.0020.09117.33
5.6.20.0100.08317.27
5.6.10.0070.08217.22
5.6.00.0020.08217.33
5.5.380.0100.07917.20
5.5.370.0100.08317.54
5.5.360.0080.08917.42
5.5.350.0030.08217.35
5.5.340.0080.08517.41
5.5.330.0030.08317.70
5.5.320.0070.07917.55
5.5.310.0100.07617.42
5.5.300.0080.06317.59
5.5.290.0150.07717.64
5.5.280.0050.08817.71
5.5.270.0080.08217.42
5.5.260.0080.08317.54
5.5.250.0080.08417.61
5.5.240.0030.08317.33
5.5.230.0050.08717.09
5.5.220.0130.06917.17
5.5.210.0070.07517.22
5.5.200.0050.08617.16
5.5.190.0070.08017.15
5.5.180.0080.07617.10
5.5.170.0070.05714.04
5.5.160.0050.06617.32
5.5.150.0020.07617.32
5.5.140.0050.08017.25
5.5.130.0070.08117.17
5.5.120.0100.07417.13
5.5.110.0020.08717.11
5.5.100.0070.08317.08
5.5.90.0100.07817.13
5.5.80.0050.06416.97
5.5.70.0020.07717.33
5.5.60.0080.08017.23
5.5.50.0080.07917.03
5.5.40.0080.06517.22
5.5.30.0100.07617.27
5.5.20.0080.07117.07
5.5.10.0130.07817.00
5.5.00.0130.07617.21
5.4.450.0000.07415.37
5.4.440.0080.07615.05
5.4.430.0050.08115.21
5.4.420.0070.08015.29
5.4.410.0020.07515.19
5.4.400.0050.08315.13
5.4.390.0080.07515.24
5.4.380.0050.05915.00
5.4.370.0020.08315.25
5.4.360.0070.08115.04
5.4.350.0080.08315.06
5.4.340.0050.08615.14
5.4.330.0030.06211.18
5.4.320.0100.07815.14
5.4.310.0080.08515.05
5.4.300.0070.06715.23
5.4.290.0100.07914.88
5.4.280.0020.07214.98
5.4.270.0100.07915.13
5.4.260.0020.07415.16
5.4.250.0030.07014.93
5.4.240.0030.07614.95
5.4.230.0050.07615.11
5.4.220.0050.06014.94
5.4.210.0050.08115.07
5.4.200.0030.07015.13
5.4.190.0050.07315.02
5.4.180.0070.08615.12
5.4.170.0050.08214.98
5.4.160.0050.08714.96
5.4.150.0020.08415.18
5.4.140.0050.08213.94
5.4.130.0020.08813.76
5.4.120.0030.07713.74
5.4.110.0070.08213.78
5.4.100.0070.07913.91
5.4.90.0020.07713.75
5.4.80.0080.08213.64
5.4.70.0000.08213.73
5.4.60.0080.07513.69
5.4.50.0100.07913.82
5.4.40.0050.08113.74
5.4.30.0050.07613.81
5.4.20.0110.08513.80
5.4.10.0050.07413.58
5.4.00.0030.07613.50
5.3.290.0070.08712.69
5.3.280.0070.08012.59
5.3.270.0070.07912.74
5.3.260.0020.09012.59
5.3.250.0000.07012.66
5.3.240.0080.08112.56
5.3.230.0050.09112.63
5.3.220.0050.09112.46
5.3.210.0070.08512.55
5.3.200.0020.08512.50
5.3.190.0070.08812.50
5.3.180.0020.09112.58
5.3.170.0070.08212.48
5.3.160.0050.08512.50
5.3.150.0050.08912.65
5.3.140.0050.08512.54
5.3.130.0050.08812.61
5.3.120.0030.07012.57
5.3.110.0050.07212.57
5.3.100.0050.08612.27
5.3.90.0030.07712.38
5.3.80.0100.07912.27
5.3.70.0080.08112.22
5.3.60.0060.07512.32
5.3.50.0030.07012.30
5.3.40.0030.07312.25
5.3.30.0050.06712.29
5.3.20.0070.07212.21
5.3.10.0030.08812.03
5.3.00.0020.08412.07
5.2.170.0070.10011.11
5.2.160.0070.09311.05
5.2.150.0070.10311.09
5.2.140.0030.07711.16
5.2.130.0070.10011.23
5.2.120.0070.05311.13
5.2.110.0070.09011.04
5.2.100.0000.12311.14
5.2.90.0130.08011.23
5.2.80.0100.08311.05
5.2.70.0070.11011.16
5.2.60.0030.07011.18
5.2.50.0030.10311.14
5.2.40.0000.07011.10
5.2.30.0030.11011.12
5.2.20.0070.11011.02
4.4.90.0000.1509.18
4.4.80.0100.1409.18

preferences:
38.72 ms | 400 KiB | 5 Q