3v4l.org

run code in 300+ PHP versions simultaneously
<?php function alter_macros($content) { preg_match_all('#{(.*)}#Ui', $content, $matches); for($i = 0; $i < count($matches[1]); $i++) { $ns = explode("|", $matches[1][$i]); $c2 = count($ns); $rand = rand(0, ($c2 - 1)); $content = str_replace("{".$matches[1][$i]."}", $ns[$rand], $content); } return $content; } function xnum_macros($content) { preg_match_all('#\[NUM\-([[:digit:]]+)\]#', $content, $matches); for($i = 0; $i < count($matches[0]); $i++) { $num = $matches[1][$i]; $min = pow(10, $num - 1); $max = pow(10, $num) - 1; $rand = rand($min, $max); $content = str_replace($matches[0][$i], $rand, $content); } return $content; } function num_macros($content) { preg_match_all('#\[RAND\-([[:digit:]]+)\-([[:digit:]]+)\]#', $content, $matches); for($i = 0; $i < count($matches[0]); $i++) { $min = $matches[1][$i]; $max = $matches[2][$i]; $rand = rand($min, $max); $content = str_replace($matches[0][$i], $rand, $content); } return $content; } function fteil_macros($content, $fteil) { return str_replace("[FTEIL]", $fteil, $content); } if(!strpos("abc.doc", ".jpg")) { $filename = alter_macros($file['name']); $filename = num_macros($filename); $filename = xnum_macros($filename); echo $filename; }

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.3.120.0070.01315.03
7.3.110.0090.00614.85
7.3.100.0060.01015.25
7.3.90.0110.00415.27
7.3.80.0070.00315.18
7.3.70.0100.00315.18
7.3.60.0040.01214.73
7.3.50.0030.01415.20
7.3.40.0130.00014.69
7.3.30.0000.00915.14
7.3.20.0090.00916.73
7.3.10.0070.00816.97
7.3.00.0110.00516.77
7.2.240.0080.01215.30
7.2.230.0060.00915.01
7.2.220.0060.00315.20
7.2.210.0040.00815.16
7.2.200.0030.00615.09
7.2.190.0100.00714.93
7.2.180.0080.00815.39
7.2.170.0060.00915.23
7.2.160.0090.00615.30
7.2.150.0030.01617.17
7.2.140.0030.01316.96
7.2.130.0040.01117.20
7.2.120.0070.00717.12
7.2.110.0040.00917.03
7.2.100.0090.00616.85
7.2.90.0040.01217.20
7.2.80.0030.01017.18
7.2.70.0050.01316.92
7.2.60.0080.00817.17
7.2.50.0080.00817.14
7.2.40.0020.01517.13
7.2.30.0050.00817.22
7.2.20.0030.00817.08
7.2.10.0030.00817.18
7.2.00.0060.00917.94
7.1.330.0000.01915.96
7.1.320.0040.00716.15
7.1.310.0090.00616.08
7.1.300.0070.01015.98
7.1.290.0040.00715.86
7.1.280.0040.01115.99
7.1.270.0030.00915.63
7.1.260.0000.01416.09
7.1.250.0060.00516.04
7.1.100.0080.00318.01
7.1.70.0000.01017.14
7.1.60.0070.01719.59
7.1.50.0070.01417.17
7.1.00.0100.07022.46
7.0.200.0120.00416.82
7.0.100.0030.09020.04
7.0.90.0170.07319.92
7.0.80.0170.08319.88
7.0.70.0400.07319.90
7.0.60.0330.06019.96
7.0.50.0330.06720.34
7.0.40.0170.07020.11
7.0.30.0130.07720.05
7.0.20.0100.07720.03
7.0.10.0000.08320.04
7.0.00.0130.06320.02
5.6.280.0070.07021.14
5.6.250.0030.05720.60
5.6.240.0070.04320.69
5.6.230.0070.06020.69
5.6.220.0030.09020.66
5.6.210.0100.07320.45
5.6.200.0000.08321.06
5.6.190.0130.07021.07
5.6.180.0000.08721.10
5.6.170.0030.06721.07
5.6.160.0030.08321.05
5.6.150.0030.08321.14
5.6.140.0130.08321.11
5.6.130.0170.07021.07
5.6.120.0130.08021.05
5.6.110.0070.08721.00
5.6.100.0100.07721.08
5.6.90.0100.08021.01
5.6.80.0030.05020.51
5.6.70.0070.08320.35
5.6.60.0170.07020.55
5.6.50.0130.04720.42
5.6.40.0100.08020.38
5.6.30.0130.07020.54
5.6.20.0130.05720.38
5.6.10.0030.05720.29
5.6.00.0070.08320.52
5.5.380.0000.08020.37
5.5.370.0030.05320.57
5.5.360.0100.08020.33
5.5.350.0100.07720.46
5.5.340.0070.08020.91
5.5.330.0030.07320.89
5.5.320.0200.07020.89
5.5.310.0000.08720.90
5.5.300.0030.08320.87
5.5.290.0030.08720.75
5.5.280.0130.07720.92
5.5.270.0100.07720.64
5.5.260.0100.08320.86
5.5.250.0130.07320.73
5.5.240.0030.05020.04
5.5.230.0070.08320.25
5.5.220.0070.08020.21
5.5.210.0130.05720.27
5.5.200.0070.08020.00
5.5.190.0000.05720.25
5.5.180.0000.07720.29
5.5.160.0170.07020.17
5.5.150.0100.08320.19
5.5.140.0130.07020.00
5.5.130.0130.07320.27
5.5.120.0000.07720.23
5.5.110.0130.08020.23
5.5.100.0030.05020.03
5.5.90.0070.04720.10
5.5.80.0070.08020.07
5.5.70.0070.06720.01
5.5.60.0130.07020.16
5.5.50.0030.07720.15
5.5.40.0070.08020.06
5.5.30.0100.07720.00
5.5.20.0030.08020.16
5.5.10.0200.06720.13
5.5.00.0100.08020.01
5.4.450.0100.06019.54
5.4.440.0000.08719.17
5.4.430.0200.03719.27
5.4.420.0130.07319.29
5.4.410.0100.06719.12
5.4.400.0100.07019.08
5.4.390.0030.07319.03
5.4.380.0070.04319.09
5.4.370.0070.07718.94
5.4.360.0100.05019.03
5.4.350.0130.06019.13
5.4.340.0100.07319.03
5.4.320.0170.07718.90
5.4.310.0030.05718.89
5.4.300.0000.09019.13
5.4.290.0070.06718.87
5.4.280.0170.07319.14
5.4.270.0030.04719.16
5.4.260.0130.06719.12
5.4.250.0100.07719.06
5.4.240.0000.07019.18
5.4.230.0030.05018.84
5.4.220.0170.06719.04
5.4.210.0130.06718.95
5.4.200.0100.05719.17
5.4.190.0100.07719.13
5.4.180.0130.07019.21
5.4.170.0100.07318.84
5.4.160.0200.06019.03
5.4.150.0130.07019.11
5.4.140.0100.07016.39
5.4.130.0100.06716.48
5.4.120.0130.05716.46
5.4.110.0070.04016.56
5.4.100.0030.04316.44
5.4.90.0030.05316.54
5.4.80.0030.07316.54
5.4.70.0170.06016.48
5.4.60.0100.03716.48
5.4.50.0100.06716.30
5.4.40.0030.07016.41
5.4.30.0100.06316.34
5.4.20.0100.07016.47
5.4.10.0070.06716.32
5.4.00.0100.07015.78
5.3.290.0070.08014.64
5.3.280.0030.08014.68
5.3.270.0070.06314.60
5.3.260.0130.06314.69
5.3.250.0070.07714.73
5.3.240.0070.07714.55
5.3.230.0070.08014.65
5.3.220.0100.04014.57
5.3.210.0130.07014.69
5.3.200.0070.07014.65
5.3.190.0130.07014.60
5.3.180.0030.05314.50
5.3.170.0070.05314.55
5.3.160.0100.08014.61
5.3.150.0070.08014.63
5.3.140.0100.07314.63
5.3.130.0030.04714.60
5.3.120.0170.06714.53
5.3.110.0000.07314.63
5.3.100.0070.07713.98
5.3.90.0030.07714.09
5.3.80.0070.07314.05
5.3.70.0070.07014.15
5.3.60.0070.04013.91
5.3.50.0070.06314.02
5.3.40.0100.07713.96
5.3.30.0070.07314.00
5.3.20.0030.07013.78
5.3.10.0100.07313.66
5.3.00.0070.06013.54
5.2.170.0030.06311.63
5.2.160.0070.06011.63
5.2.150.0000.05311.63
5.2.140.0030.06311.63
5.2.130.0100.05711.63
5.2.120.0130.05311.63
5.2.110.0030.06011.63
5.2.100.0130.05311.63
5.2.90.0000.04311.63
5.2.80.0070.05711.63
5.2.70.0100.03011.63
5.2.60.0070.06011.63
5.2.50.0070.05011.63
5.2.40.0100.05711.63
5.2.30.0070.05311.63
5.2.20.0070.06011.63
5.2.10.0070.05711.63
5.2.00.0070.06011.63
5.1.60.0070.05011.63
5.1.50.0070.05011.63
5.1.40.0100.04711.63
5.1.30.0000.06311.63
5.1.20.0100.05311.63
5.1.10.0000.05711.63
5.1.00.0030.05711.63
5.0.50.0070.04711.63
5.0.40.0030.04011.63
5.0.30.0000.04311.63
5.0.20.0000.02311.63
5.0.10.0030.02011.63
5.0.00.0000.03311.63
4.4.90.0000.04011.63
4.4.80.0030.03311.63
4.4.70.0030.02311.63
4.4.60.0070.03011.63
4.4.50.0030.03311.63
4.4.40.0000.05011.63
4.4.30.0000.03711.63
4.4.20.0030.03711.63
4.4.10.0070.03311.63
4.4.00.0030.05011.63
4.3.110.0000.02311.63
4.3.100.0000.01711.63
4.3.90.0030.03011.63
4.3.80.0070.02011.63
4.3.70.0000.01711.63
4.3.60.0030.01311.63
4.3.50.0000.01711.63
4.3.40.0070.03711.63
4.3.30.0000.01711.63
4.3.20.0000.02011.63
4.3.10.0030.01311.63
4.3.00.0030.01311.63

preferences:
39.04 ms | 400 KiB | 5 Q