3v4l.org

run code in 300+ PHP versions simultaneously
<?php function process_template($html,$b='<<',$e='>>'){ $replace=['this'=>'<input name="this" />','that'=>'<input name="that" />']; if(preg_match_all('/('.$b.')(.*?)('.$e.')/is',$html,$matches,PREG_SET_ORDER|PREG_OFFSET_CAPTURE)){ $t='';$o=0; foreach($matches as $m){ $t.=substr($html,$o,$m[0][1]-$o); $t.=$replace[$m[2][0]]; $o=$m[3][1]+strlen($m[3][0]); } $t.=substr($html,$o); $html=$t; } return $html; } $html=" <div> <<this>> <<that>> </div> "; $new=process_template($html); echo $new;

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.5.10.0050.00516.92
8.5.00.0170.00520.09
8.4.150.0020.00014.05
8.4.140.0130.00817.95
8.4.130.0050.00418.71
8.4.120.0090.01124.09
8.4.110.0120.00822.19
8.4.100.0050.00418.04
8.4.90.0130.00818.83
8.4.80.0090.01118.27
8.4.70.0150.00518.09
8.4.60.0110.00919.03
8.4.50.0140.00720.55
8.4.40.0060.01319.76
8.4.30.0100.00920.55
8.4.20.0040.00418.87
8.4.10.0110.00017.86
8.3.280.0130.00718.52
8.3.270.0120.00716.79
8.3.260.0120.00716.52
8.3.250.0140.00518.87
8.3.240.0130.00817.20
8.3.230.0100.01017.05
8.3.220.0090.00917.34
8.3.210.0110.00716.66
8.3.200.0080.00817.01
8.3.190.0100.00518.88
8.3.180.0090.01016.75
8.3.170.0090.00917.30
8.3.160.0070.01116.82
8.3.150.0100.01018.94
8.3.140.0050.00516.54
8.3.130.0040.01116.81
8.3.120.0110.00018.86
8.3.110.0090.00620.94
8.3.100.0060.00316.91
8.3.90.0030.00618.80
8.3.80.0080.00318.43
8.3.70.0090.00616.63
8.3.60.0120.00916.63
8.3.50.0140.00521.21
8.3.40.0000.01519.00
8.3.30.0120.00318.84
8.3.20.0040.00421.95
8.3.10.0080.00022.10
8.3.00.0000.00823.60
8.2.290.0050.00420.74
8.2.280.0110.00818.54
8.2.270.0090.00917.24
8.2.260.0030.00520.64
8.2.250.0140.00318.75
8.2.240.0030.00719.27
8.2.230.0030.01322.58
8.2.220.0070.00724.06
8.2.210.0040.00426.77
8.2.200.0120.00318.66
8.2.190.0070.00716.75
8.2.180.0120.00317.00
8.2.170.0070.01022.96
8.2.160.0070.00720.52
8.2.150.0090.00024.18
8.2.140.0050.00324.66
8.2.130.0000.00726.16
8.2.120.0050.00219.82
8.2.110.0070.00422.33
8.2.100.0120.00018.03
8.2.90.0050.00318.03
8.2.80.0000.00919.29
8.2.70.0090.00017.50
8.2.60.0040.00418.34
8.2.50.0050.00318.10
8.2.40.0030.00621.33
8.2.30.0050.00319.34
8.2.20.0040.00418.13
8.2.10.0030.00519.34
8.2.00.0000.00919.41
8.1.330.0050.00323.44
8.1.320.0130.00716.61
8.1.310.0130.00316.96
8.1.300.0070.00318.26
8.1.290.0040.00818.88
8.1.280.0110.00425.92
8.1.270.0030.00622.07
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0060.00322.14
8.1.230.0060.00622.70
8.1.220.0080.00017.77
8.1.210.0040.00418.78
8.1.200.0000.00917.48
8.1.190.0030.00517.38
8.1.180.0030.00618.10
8.1.170.0040.00418.84
8.1.160.0000.00820.70
8.1.150.0040.00418.97
8.1.140.0000.00720.83
8.1.130.0030.00320.16
8.1.120.0000.00717.58
8.1.110.0000.00717.51
8.1.100.0040.00417.59
8.1.90.0030.00517.52
8.1.80.0000.00817.61
8.1.70.0000.00717.63
8.1.60.0000.00817.74
8.1.50.0030.00617.71
8.1.40.0030.00617.66
8.1.30.0040.00417.77
8.1.20.0030.00617.79
8.1.10.0000.00817.62
8.1.00.0050.00317.55
8.0.300.0060.00320.03
8.0.290.0040.00416.75
8.0.280.0070.00018.46
8.0.270.0030.00616.97
8.0.260.0000.00619.96
8.0.250.0000.00817.14
8.0.240.0050.00317.09
8.0.230.0070.00017.05
8.0.220.0040.00417.06
8.0.210.0070.00017.04
8.0.200.0000.00917.14
8.0.190.0060.00317.14
8.0.180.0040.00416.88
8.0.170.0000.00817.08
8.0.160.0000.00717.05
8.0.150.0000.00916.85
8.0.140.0000.00716.95
8.0.130.0000.00513.42
8.0.120.0000.00716.97
8.0.110.0000.00817.04
8.0.100.0050.00217.01
8.0.90.0030.00616.94
8.0.80.0120.00316.99
8.0.70.0040.00416.85
8.0.60.0070.00017.03
8.0.50.0040.00417.07
8.0.30.0100.01117.22
8.0.20.0040.01417.53
8.0.10.0000.00717.10
8.0.00.0110.01217.13
7.4.330.0020.00215.55
7.4.320.0070.00016.74
7.4.300.0040.00416.65
7.4.290.0000.01016.69
7.4.280.0080.00016.70
7.4.270.0040.00416.79
7.4.260.0000.00513.47
7.4.250.0000.00716.77
7.4.240.0060.00116.80
7.4.230.0030.00316.92
7.4.220.0020.00516.69
7.4.210.0100.00916.74
7.4.200.0000.00716.54
7.4.130.0070.01017.02
7.4.120.0090.00916.65
7.4.110.0090.00916.63
7.4.100.0120.00616.71
7.4.90.0040.01416.56
7.4.80.0120.00619.39
7.4.70.0070.01016.57
7.4.60.0060.01116.80
7.4.50.0030.01416.53
7.4.40.0150.00916.52
7.4.00.0100.00614.96
7.3.330.0070.00016.54
7.3.320.0080.00013.37
7.3.310.0030.00316.52
7.3.300.0030.00316.45
7.3.290.0000.00716.48
7.3.280.0060.01216.37
7.3.260.0120.01016.67
7.3.240.0080.00916.59
7.3.230.0140.00716.81
7.3.210.0180.00016.63
7.3.200.0060.00916.53
7.3.190.0080.00816.43
7.3.180.0120.00616.77
7.3.170.0150.00316.48
7.3.160.0130.00316.60
7.3.70.0120.00414.86
7.3.60.0120.00214.71
7.3.50.0130.00715.12
7.3.40.0100.00614.80
7.3.30.0110.00514.89
7.3.20.0070.01114.97
7.3.10.0120.00814.72
7.3.00.0100.00315.07
7.2.330.0100.01416.85
7.2.320.0070.01016.86
7.2.310.0090.00916.99
7.2.300.0100.01416.91
7.2.290.0060.01016.75
7.2.200.0130.00014.73
7.2.190.0090.00515.00
7.2.180.0040.00715.38
7.2.170.0090.00415.39
7.2.160.0080.00415.25
7.2.150.0120.00915.37
7.2.140.0080.01115.15
7.2.130.0090.00615.14
7.2.120.0180.00015.30
7.2.110.0070.01315.23
7.2.100.0140.00315.12
7.2.90.0120.00915.00
7.2.80.0070.01115.13
7.2.70.0880.01015.38
7.2.60.0120.00615.02
7.2.50.0150.00615.05
7.2.40.0110.00815.37
7.2.30.0100.01015.30
7.2.20.0180.00415.10
7.2.10.0070.01415.17
7.2.00.0310.00315.35
7.1.300.0100.00914.16
7.1.290.0180.00414.14
7.1.280.0120.00614.18
7.1.270.0090.00914.29
7.1.260.0060.00914.10
7.1.250.0100.00614.21

preferences:
167.12 ms | 403 KiB | 5 Q