3v4l.org

run code in 300+ PHP versions simultaneously
<?php $html = <<<HTML <h1>Or Any Other tags except img or nothing</h1> <span>stuff</span> <img src="{{media url=&quot;image_name.png&quot;}}" alt="image_test" /> <div>more stuff</div> <h1>Or Any Other tags except img or nothing</h1> HTML; function alterateContent(string $html, string $imageFileName, string $replacement): string { $imageFileName = preg_quote($imageFileName, '/'); return preg_replace("/<img\h+src=\"{{media url=&quot;{$imageFileName}&quot;}}\".*?\/>/", $replacement, $html); } echo alterateContent($html, 'image_name.png', '<b>Hi test</b>');

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.140.0120.01017.51
8.4.130.0100.00818.02
8.4.120.0090.00720.53
8.4.110.0130.00822.68
8.4.100.0140.00717.64
8.4.90.0140.00818.79
8.4.80.0150.00518.04
8.4.70.0090.01118.08
8.4.60.0110.01118.66
8.4.50.0120.00917.91
8.4.40.0030.00619.73
8.4.30.0130.00620.28
8.4.20.0130.00724.45
8.4.10.0100.01024.10
8.3.270.0090.01016.53
8.3.260.0120.00416.61
8.3.250.0110.00618.89
8.3.240.0120.00716.44
8.3.230.0110.00716.74
8.3.220.0060.00217.02
8.3.210.0050.00716.59
8.3.200.0030.00616.47
8.3.190.0060.00316.58
8.3.180.0100.01116.68
8.3.170.0090.00916.46
8.3.160.0150.00316.75
8.3.150.0110.00717.04
8.3.140.0050.00316.84
8.3.130.0030.00616.97
8.3.120.0040.00420.84
8.3.110.0000.00916.95
8.3.100.0040.00418.55
8.3.90.0050.00326.77
8.3.80.0100.00016.63
8.3.70.0100.01016.63
8.3.60.0110.00716.75
8.3.50.0210.00624.43
8.3.40.0090.01320.89
8.3.30.0130.00318.92
8.3.20.0070.00024.18
8.3.10.0040.00424.66
8.3.00.0090.00926.16
8.2.290.0100.00820.66
8.2.280.0120.00822.59
8.2.270.0170.00316.71
8.2.260.0060.00318.89
8.2.250.0040.00417.16
8.2.240.0130.00618.74
8.2.230.0090.00020.94
8.2.220.0110.00424.06
8.2.210.0060.00326.77
8.2.200.0100.00018.66
8.2.190.0150.00016.88
8.2.180.0000.01425.92
8.2.170.0120.00619.08
8.2.160.0070.00722.96
8.2.150.0070.00325.66
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0080.00026.35
8.2.110.0060.00320.21
8.2.100.0060.00617.91
8.2.90.0000.00817.63
8.2.80.0000.00818.86
8.2.70.0060.00317.75
8.2.60.0030.00617.75
8.2.50.0050.00318.05
8.2.40.0030.00518.03
8.2.30.0050.00317.98
8.2.20.0000.00818.03
8.2.10.0050.00319.31
8.2.00.0000.00719.33
8.1.330.0150.00422.02
8.1.320.0120.00616.59
8.1.310.0050.00318.65
8.1.300.0120.00620.07
8.1.290.0040.00730.84
8.1.280.0160.00625.92
8.1.270.0070.00722.19
8.1.260.0040.00428.09
8.1.250.0100.00328.09
8.1.240.0090.00018.95
8.1.230.0110.00022.25
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0000.00817.48
8.1.190.0060.00317.35
8.1.180.0080.00018.10
8.1.170.0030.00518.59
8.1.160.0000.00718.86
8.1.150.0040.00418.92
8.1.140.0050.00218.78
8.1.130.0070.00019.99
8.1.120.0000.00817.57
8.1.110.0050.00317.50
8.1.100.0040.00417.52
8.1.90.0000.00717.44
8.1.80.0000.01117.57
8.1.70.0070.00017.61
8.1.60.0090.00017.71
8.1.50.0040.00417.70
8.1.40.0030.00617.68
8.1.30.0000.00817.78
8.1.20.0040.00417.78
8.1.10.0030.00617.63
8.1.00.0040.00417.67
8.0.300.0070.00018.77
8.0.290.0040.00416.88
8.0.280.0070.00020.23
8.0.270.0050.00218.22
8.0.260.0000.00718.47
8.0.250.0000.00717.05
8.0.240.0000.00717.11
8.0.230.0000.00717.17
8.0.220.0030.00317.08
8.0.210.0050.00217.07
8.0.200.0030.00317.19
8.0.190.0000.00717.23
8.0.180.0030.00517.17
8.0.170.0060.00317.10
8.0.160.0060.00317.17
8.0.150.0030.00417.01
8.0.140.0000.00816.96
8.0.130.0050.00013.54
8.0.120.0060.00317.10
8.0.110.0000.00816.95
8.0.100.0000.00717.11
8.0.90.0000.00816.95
8.0.80.0050.01417.06
8.0.70.0030.00616.91
8.0.60.0000.00717.21
8.0.50.0000.00717.02
8.0.30.0080.01217.41
8.0.20.0090.01217.28
8.0.10.0040.00417.12
8.0.00.0180.00417.02
7.4.330.0020.00215.55
7.4.320.0030.00316.59
7.4.300.0000.00616.65
7.4.290.0060.00316.81
7.4.280.0030.00516.87
7.4.270.0070.00016.74
7.4.260.0030.00313.52
7.4.250.0050.00216.70
7.4.240.0000.00716.64
7.4.230.0040.00416.57
7.4.220.0030.00316.78
7.4.210.0080.00816.77
7.4.200.0050.00216.66
7.4.130.0130.01016.79
7.4.120.0090.01216.79
7.4.110.0070.01016.67
7.4.100.0060.01216.46
7.4.90.0140.00916.65
7.4.80.0060.01216.58
7.4.70.0030.01416.66
7.4.60.0000.01716.37
7.4.50.0070.01016.75
7.4.40.0100.00716.46
7.4.30.0060.01216.66
7.4.20.0070.01116.54
7.4.10.0060.01216.57
7.4.00.0130.00716.63
7.3.330.0000.00716.59
7.3.320.0000.00513.37
7.3.310.0000.00716.49
7.3.300.0060.00016.61
7.3.290.0120.00716.61
7.3.260.0130.00716.70
7.3.230.0180.00616.53
7.3.220.0060.01516.77
7.3.210.0150.00416.72
7.3.200.0120.00616.76
7.3.190.0130.00316.67
7.3.180.0070.01016.64
7.3.170.0090.00916.71
7.3.160.0170.00016.50
7.3.150.0110.01116.68
7.3.140.0110.00716.59
7.3.130.0180.00016.62
7.3.120.0040.01416.78
7.3.110.0070.01016.59
7.3.100.0100.00716.45
7.3.90.0100.01216.85
7.3.80.0120.00616.70
7.3.70.0100.00716.48
7.3.60.0120.00916.58
7.3.50.0130.01016.56
7.3.40.0170.00016.62
7.3.30.0110.00616.63
7.3.20.0350.01216.53
7.3.10.0140.00916.52
7.3.00.0100.00716.48
7.2.330.0090.00916.71
7.2.320.0140.00316.57
7.2.310.0110.00716.79
7.2.300.0180.00016.65
7.2.290.0120.00616.75
7.2.280.0070.01716.60
7.2.270.0120.01216.66
7.2.260.0070.01416.51
7.2.250.0100.01016.61
7.2.240.0060.01116.75
7.2.230.0110.01516.87
7.2.220.0090.00916.79
7.2.210.0090.00916.49
7.2.200.0150.00416.77
7.2.190.0130.01016.62
7.2.180.0130.01016.68
7.2.170.0090.00916.58
7.2.160.0090.00916.64
7.2.150.0170.01016.75
7.2.140.0130.00716.67
7.2.130.0070.01016.80
7.2.120.0110.00816.85
7.2.110.0060.01216.74
7.2.100.0030.01616.64
7.2.90.0120.00616.70
7.2.80.0060.01116.77
7.2.70.0180.00016.59
7.2.60.0040.01916.57
7.2.50.0190.00316.72
7.2.40.0110.01116.81
7.2.30.0130.00916.75
7.2.20.0110.01116.66
7.2.10.0120.00916.81
7.2.00.0090.00916.72

preferences:
37.86 ms | 403 KiB | 5 Q