3v4l.org

run code in 300+ PHP versions simultaneously
<?php function contentBeforeLoop($content) { $array = ['Hello', 'World', '!']; foreach($array as $item) { $content = str_replace('$item', $item, $content); echo $content . "\n"; $content = str_replace($item, '$item', $content); } } contentBeforeLoop('item: $item');

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)
8.4.20.0160.00317.49
8.4.10.0090.00019.44
8.3.150.0140.00420.60
8.3.140.0060.00316.50
8.3.130.0000.00818.33
8.3.120.0040.00420.75
8.3.110.0060.00320.94
8.3.100.0060.00324.06
8.3.90.0110.00326.77
8.3.80.0070.00317.97
8.3.70.0110.00716.63
8.3.60.0120.00316.62
8.3.50.0160.00522.82
8.3.40.0110.00418.72
8.3.30.0000.01418.55
8.3.20.0070.00021.77
8.3.10.0070.00020.21
8.3.00.0080.00019.85
8.2.270.0120.00616.83
8.2.260.0070.01119.09
8.2.250.0030.01316.57
8.2.240.0060.00318.95
8.2.230.0000.00822.58
8.2.220.0110.00037.54
8.2.210.0090.00626.77
8.2.200.0100.00018.41
8.2.190.0070.01120.30
8.2.180.0130.00618.38
8.2.170.0070.00722.96
8.2.160.0100.01020.35
8.2.150.0070.00024.18
8.2.140.0050.00324.66
8.2.130.0040.00419.95
8.2.120.0070.00026.35
8.2.110.0030.00620.43
8.2.100.0080.00417.78
8.2.90.0050.00317.74
8.2.80.0000.00817.97
8.2.70.0040.00417.63
8.2.60.0050.00317.80
8.2.50.0040.00418.10
8.2.40.0000.00820.65
8.2.30.0080.00019.13
8.2.20.0020.00517.93
8.2.10.0080.00018.19
8.2.00.0000.00817.85
8.1.310.0110.00716.59
8.1.300.0110.00718.25
8.1.290.0060.00330.84
8.1.280.0150.00025.92
8.1.270.0050.00222.15
8.1.260.0000.00826.35
8.1.250.0000.00728.09
8.1.240.0060.00322.42
8.1.230.0040.00821.04
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0040.00417.48
8.1.190.0030.00517.36
8.1.180.0080.00018.10
8.1.170.0030.00618.61
8.1.160.0040.00418.90
8.1.150.0000.00822.11
8.1.140.0040.00419.71
8.1.130.0030.00319.02
8.1.120.0040.00417.37
8.1.110.0000.00817.45
8.1.100.0040.00417.36
8.1.90.0040.00417.47
8.1.80.0030.00417.43
8.1.70.0030.00317.47
8.1.60.0000.00717.57
8.1.50.0040.00417.56
8.1.40.0030.00617.41
8.1.30.0040.00417.70
8.1.20.0030.00517.73
8.1.10.0000.00717.43
8.1.00.0000.00817.46
8.0.300.0080.00019.89
8.0.290.0050.00216.75
8.0.280.0050.00218.29
8.0.270.0030.00517.34
8.0.260.0030.00317.27
8.0.250.0070.00017.01
8.0.240.0040.00416.96
8.0.230.0040.00416.95
8.0.220.0060.00316.80
8.0.210.0000.00716.76
8.0.200.0040.00416.97
8.0.190.0000.00717.00
8.0.180.0040.00416.80
8.0.170.0040.00416.95
8.0.160.0090.00016.83
8.0.150.0040.00416.85
8.0.140.0000.00716.77
8.0.130.0060.00313.28
8.0.120.0040.00416.87
8.0.110.0000.00716.84
8.0.100.0040.00416.87
8.0.90.0000.00716.95
8.0.80.0060.01016.96
8.0.70.0040.00416.94
8.0.60.0040.00416.84
8.0.50.0070.00016.93
8.0.30.0100.00917.00
8.0.20.0110.00917.40
8.0.10.0040.00416.84
8.0.00.0170.00316.94
7.4.330.0000.00515.55
7.4.320.0000.00716.60
7.4.300.0000.00616.38
7.4.290.0050.00316.50
7.4.280.0030.00616.49
7.4.270.0040.00416.63
7.4.260.0040.00416.60
7.4.250.0030.00316.32
7.4.240.0070.00016.54
7.4.230.0080.00016.50
7.4.220.0140.00416.52
7.4.210.0100.00316.50
7.4.200.0000.00616.63
7.4.160.0080.00816.38
7.4.150.0030.01717.40
7.4.140.0080.01017.86
7.4.130.0060.01316.50
7.4.120.0120.00616.56
7.4.110.0080.00816.47
7.4.100.0130.00316.52
7.4.90.0140.00916.43
7.4.80.0070.01419.39
7.4.70.0100.00616.64
7.4.60.0090.01016.68
7.4.50.0090.00316.51
7.4.40.0070.01016.42
7.4.30.0140.00716.42
7.4.10.0050.01014.93
7.4.00.0040.01215.06
7.3.330.0000.00513.16
7.3.320.0030.00213.23
7.3.310.0030.00316.40
7.3.300.0000.00716.30
7.3.290.0080.00716.31
7.3.280.0050.01216.27
7.3.270.0070.01017.40
7.3.260.0030.01416.60
7.3.250.0100.00916.36
7.3.240.0100.00816.39
7.3.230.0030.01516.62
7.3.210.0030.01316.36
7.3.200.0000.02116.56
7.3.190.0070.01016.43
7.3.180.0090.00716.29
7.3.170.0040.01216.56
7.3.160.0060.01016.67
7.3.130.0050.01314.88
7.3.120.0080.01014.99
7.3.110.0040.01314.97
7.3.100.0020.01014.76
7.3.90.0060.01114.79
7.3.80.0090.00515.03
7.3.70.0030.00814.73
7.3.60.0010.01114.89
7.3.50.0010.01314.59
7.3.40.0060.00614.68
7.3.30.0060.00714.76
7.3.20.0050.00516.57
7.3.10.0000.01416.55
7.3.00.0030.01116.68
7.2.330.0110.00616.81
7.2.320.0070.01016.50
7.2.310.0100.00616.86
7.2.300.0130.00416.61
7.2.290.0120.00616.70
7.2.260.0070.01115.07
7.2.250.0080.00715.12
7.2.240.0020.01115.01
7.2.230.0090.00614.87
7.2.220.0100.00715.02
7.2.210.0050.01415.03
7.2.200.0050.01015.04
7.2.190.0030.01414.96
7.2.180.0080.00515.19
7.2.170.0050.00715.01
7.2.160.0020.00814.93
7.2.150.0030.01016.89
7.2.140.0030.01016.86
7.2.130.0070.00916.82
7.2.120.0090.00316.92
7.2.110.0030.00916.97
7.2.100.0070.00816.93
7.2.90.0050.01116.96
7.2.80.0050.00916.78
7.2.70.0050.00816.89
7.2.60.0060.00516.82
7.2.50.0130.00516.98
7.2.40.0050.01216.82
7.2.30.0100.00716.82
7.2.20.0050.00717.01
7.2.10.0060.00816.92
7.2.00.0090.00416.82
7.1.330.0030.01015.85
7.1.320.0070.00715.73
7.1.310.0090.00315.59
7.1.300.0010.01015.77
7.1.290.0060.00915.63
7.1.280.0070.00615.66
7.1.270.0070.00715.87
7.1.260.0050.00815.76
7.1.250.0060.00715.83
7.1.240.0080.00415.88
7.1.230.0050.00815.70
7.1.220.0100.00415.64
7.1.210.0120.00315.80
7.1.200.0050.00815.74
7.1.190.0030.01015.70
7.1.180.0040.00615.62
7.1.170.0060.00915.90
7.1.160.0040.00715.71
7.1.150.0100.00315.75
7.1.140.0000.01315.74
7.1.130.0000.01315.70
7.1.120.0050.00715.73
7.1.110.0080.00515.81
7.1.100.0060.00915.88
7.1.90.0060.00615.88
7.1.80.0000.01415.75
7.1.70.0070.00716.02
7.1.60.0110.00416.15
7.1.50.0050.00715.88
7.1.40.0060.00715.67
7.1.30.0030.00915.73
7.1.20.0040.01115.55
7.1.10.0110.02917.33
7.1.00.0240.02417.33
7.0.330.0060.00715.37
7.0.320.0070.00515.42
7.0.310.0050.00915.30
7.0.300.0060.00915.38
7.0.290.0050.00615.38
7.0.280.0070.00615.44
7.0.270.0050.00515.40
7.0.260.0050.01015.43
7.0.250.0050.00915.42
7.0.240.0030.01015.65
7.0.230.0050.00715.45
7.0.220.0040.00915.46
7.0.210.0040.00915.53
7.0.200.0070.00515.85
7.0.190.0050.00715.36
7.0.180.0060.00715.30
7.0.170.0030.01115.39
7.0.160.0000.01115.38
7.0.150.0130.02316.88
7.0.140.0120.02616.90
7.0.130.0160.02216.97
7.0.120.0150.02217.00
7.0.110.0140.02316.90
7.0.100.0160.02216.97
7.0.90.0090.03316.98
7.0.80.0180.02216.99
7.0.70.0160.02117.00
7.0.60.0150.02216.93
7.0.50.0190.02117.13
7.0.40.0240.01415.59
7.0.30.0100.02715.57
7.0.20.0170.02315.75
7.0.10.0160.02315.68
7.0.00.0150.02415.68
5.6.400.0050.00614.63
5.6.390.0020.01314.25
5.6.380.0100.00214.23
5.6.370.0090.00614.33
5.6.360.0040.01014.27
5.6.350.0070.00714.46
5.6.340.0050.00314.43
5.6.330.0030.01114.47
5.6.320.0040.01114.35
5.6.310.0100.00114.46
5.6.300.0040.00714.27
5.6.290.0050.00814.32
5.6.280.0030.00614.28
5.6.270.0030.00914.34
5.6.260.0070.00514.49
5.6.250.0050.00414.27
5.6.240.0060.00914.18
5.6.230.0080.00614.19
5.6.220.0020.01114.32
5.6.210.0040.00614.31
5.6.200.0090.00514.41
5.6.190.0050.00814.17
5.6.180.0090.00514.35
5.6.170.0050.00914.30
5.6.160.0060.00814.39
5.6.150.0030.00814.35
5.6.140.0060.00514.23
5.6.130.0030.00914.24
5.6.120.0000.01214.37
5.6.110.0060.00514.18
5.6.100.0060.00414.19
5.6.90.0050.00914.10
5.6.80.0080.00514.43
5.6.70.0040.00614.29
5.6.60.0080.00614.24
5.6.50.0050.00914.15
5.6.40.0050.00614.25
5.6.30.0030.00914.40
5.6.20.0050.00814.32
5.6.10.0020.01314.28
5.6.00.0050.00914.21

preferences:
28.52 ms | 403 KiB | 5 Q