3v4l.org

run code in 300+ PHP versions simultaneously
<?php function censorWord($word, $censor) { return preg_replace("/$censor/",'*', $word, 1); } $start = microtime(true); $word_list = ['php','javascript']; $data = "Javascript and php are awesome!"; $words = explode(" ", $data); // pass each word by reference so it can be modified inside our array foreach($words as &$word) { if(in_array(strtolower($word), $word_list)) { // this just passes the second letter of the word // as the $censor argument $word = censorWord($word, $word[1]); } } echo implode(" ", $words); // returns J*vascript and p*p are awesome! $end = (microtime(true)); echo '<br />'; echo $end - $start;

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.1.70.0030.00517.46
7.1.60.0160.00619.33
7.1.50.0070.00717.18
7.1.00.0030.07722.36
7.0.200.0030.00716.87
7.0.140.0100.06721.96
7.0.100.0400.07719.97
7.0.90.0400.06020.04
7.0.80.0570.07319.95
7.0.70.0270.07719.87
7.0.60.0370.04720.04
7.0.50.0070.05020.27
7.0.40.0070.05020.11
7.0.30.0130.06720.14
7.0.20.0030.04020.09
7.0.10.0070.04020.10
7.0.00.0100.08020.13
5.6.280.0000.07721.15
5.6.250.0130.05320.61
5.6.240.0070.07320.63
5.6.230.0070.06320.67
5.6.220.0100.07720.62
5.6.210.0000.08720.61
5.6.200.0100.07721.05
5.6.190.0100.05021.12
5.6.180.0070.05020.94
5.6.170.0130.07021.04
5.6.160.0070.08321.14
5.6.150.0070.08021.01
5.6.140.0100.08021.05
5.6.130.0030.07721.01
5.6.120.0170.07020.94
5.6.110.0070.08321.06
5.6.100.0170.07721.02
5.6.90.0100.07320.99
5.6.80.0070.07320.32
5.6.70.0170.07020.46
5.6.60.0170.06720.36
5.6.50.0170.06720.36
5.6.40.0100.03720.43
5.6.30.0070.07320.38
5.6.20.0100.07320.47
5.6.10.0100.07320.41
5.6.00.0030.09020.37
5.5.380.0130.07320.52
5.5.370.0070.09020.38
5.5.360.0100.08020.42
5.5.350.0130.07320.45
5.5.340.0030.08020.86
5.5.330.0130.07720.74
5.5.320.0070.05020.89
5.5.310.0100.07320.89
5.5.300.0070.08020.93
5.5.290.0070.05020.61
5.5.280.0070.06720.91
5.5.270.0030.08720.89
5.5.260.0100.08020.81
5.5.250.0100.05020.56
5.5.240.0070.08320.25
5.5.230.0100.06719.98
5.5.220.0100.07320.27
5.5.210.0070.07720.29
5.5.200.0070.07320.23
5.5.190.0000.08320.13
5.5.180.0100.07020.21
5.5.160.0170.06320.11
5.5.150.0070.06720.27
5.5.140.0100.08020.13
5.5.130.0100.07320.12
5.5.120.0100.07720.21
5.5.110.0030.08020.23
5.5.100.0000.05320.08
5.5.90.0070.07720.16
5.5.80.0100.06720.07
5.5.70.0100.08020.10
5.5.60.0030.09020.16
5.5.50.0100.07320.09
5.5.40.0100.06320.04
5.5.30.0070.07720.11
5.5.20.0200.06020.16
5.5.10.0100.07720.01
5.5.00.0100.07020.07
5.4.450.0030.07719.46
5.4.440.0100.07719.41
5.4.430.0000.08019.51
5.4.420.0100.07019.36
5.4.410.0030.07319.33
5.4.400.0030.07719.10
5.4.390.0130.05318.87
5.4.380.0070.04719.14
5.4.370.0070.06719.16
5.4.360.0070.05718.90
5.4.350.0000.08318.95
5.4.340.0100.07319.12
5.4.320.0100.07719.14
5.4.310.0100.05318.95
5.4.300.0030.07718.88
5.4.290.0130.06719.15
5.4.280.0000.08319.12
5.4.270.0100.07019.03
5.4.260.0170.06319.13
5.4.250.0130.07019.04
5.4.240.0100.07319.13
5.4.230.0100.07019.08
5.4.220.0070.06719.04
5.4.210.0100.06319.12
5.4.200.0070.04318.87
5.4.190.0100.04018.89
5.4.180.0100.07719.14
5.4.170.0230.05318.84
5.4.160.0070.06319.03
5.4.150.0070.07319.01
5.4.140.0030.05016.48
5.4.130.0000.04316.45
5.4.120.0030.06316.37
5.4.110.0070.07016.39
5.4.100.0070.07016.49
5.4.90.0170.06016.55
5.4.80.0000.04716.38
5.4.70.0030.07316.57
5.4.60.0030.07016.25
5.4.50.0030.04016.25
5.4.40.0070.06716.50
5.4.30.0000.06716.45
5.4.20.0070.06716.41
5.4.10.0070.07016.32
5.4.00.0100.07015.81
5.3.290.0070.05314.68
5.3.280.0030.06714.66
5.3.270.0130.06314.67
5.3.260.0030.08014.61
5.3.250.0070.06314.64
5.3.240.0130.07014.53
5.3.230.0030.07714.55
5.3.220.0030.07314.62
5.3.210.0030.07714.50
5.3.200.0100.05014.55
5.3.190.0100.07014.60
5.3.180.0030.07714.55
5.3.170.0070.06014.67
5.3.160.0100.05314.69
5.3.150.0130.06714.55
5.3.140.0030.07014.51
5.3.130.0030.03314.62
5.3.120.0070.07314.56
5.3.110.0130.06314.57
5.3.100.0100.07013.97
5.3.90.0000.07714.00
5.3.80.0070.04714.00
5.3.70.0070.07314.14
5.3.60.0030.07313.99
5.3.50.0070.07314.08
5.3.40.0100.06014.01
5.3.30.0130.06014.04
5.3.20.0000.05013.62
5.3.10.0030.06013.77
5.3.00.0030.05013.63
5.2.170.0070.04711.07
5.2.160.0100.05711.26
5.2.150.0070.05311.03
5.2.140.0030.06311.25
5.2.130.0030.06011.22
5.2.120.0070.06011.11
5.2.110.0030.04011.02
5.2.100.0070.06311.09
5.2.90.0030.06311.11
5.2.80.0070.05711.15
5.2.70.0070.05011.12
5.2.60.0130.05310.99
5.2.50.0070.04711.03
5.2.40.0100.05711.11
5.2.30.0070.06010.97
5.2.20.0030.06010.95
5.2.10.0030.05010.84
5.2.00.0070.06010.79
5.1.60.0030.0539.84
5.1.50.0070.05310.00
5.1.40.0070.0339.99
5.1.30.0070.05310.37
5.1.20.0070.05710.42
5.1.10.0070.03310.20
5.1.00.0000.03310.18
5.0.50.0030.0238.40
5.0.40.0000.0238.52
5.0.30.0000.0308.34
5.0.20.0000.0208.19
5.0.10.0000.0208.15
5.0.00.0000.0308.24
4.4.90.0030.0307.64
4.4.80.0070.0307.64
4.4.70.0030.0337.64
4.4.60.0000.0377.64
4.4.50.0030.0337.64
4.4.40.0030.0507.64
4.4.30.0030.0207.64
4.4.20.0070.0237.64
4.4.10.0000.0177.64
4.4.00.0030.0237.64
4.3.110.0000.0177.64
4.3.100.0030.0137.64
4.3.90.0030.0137.64
4.3.80.0030.0337.64
4.3.70.0000.0137.64
4.3.60.0000.0137.64
4.3.50.0030.0107.64
4.3.40.0000.0237.64
4.3.30.0000.0137.64
4.3.20.0000.0137.64
4.3.10.0000.0177.64
4.3.00.0000.0177.64

preferences:
32.82 ms | 401 KiB | 5 Q