3v4l.org

run code in 500+ PHP versions simultaneously
<?php $string = 'text a[link1], a[link2] a[link3] text text text a[link4] text a[link5] text'; $styleCounter = 0; echo preg_replace_callback( '/((?<=]))?+(,? ?)a\[([^][]*)]/', function ($m) use(&$styleCounter) { if ($m[1] === null) { ++$styleCounter; } return "{$m[2]}<a href=\"{$m[3]}\" class=\"style{$styleCounter}\">{$m[3]}</a>"; }, $string, -1, $count, PREG_UNMATCHED_AS_NULL ); /*<a href="link1" class="style1">link1</a><a href="link2" class="style1">link2</a><a href="link3" class="style1">link3</a> text text text <a href="link4" class="style2">link4</a> text <a href="link5" class="style2">link5</a> text*/

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.70.0100.00818.71
8.5.60.0090.00917.16
8.5.50.0080.00818.70
8.5.30.0110.00619.59
8.5.20.0090.00919.42
8.5.10.0090.00919.95
8.5.00.0080.01320.29
8.4.210.0070.00719.92
8.4.180.0130.00822.16
8.4.170.0100.01223.95
8.4.160.0150.00923.88
8.4.150.0070.00716.90
8.4.140.0110.01017.61
8.4.130.0150.00617.90
8.4.120.0110.00920.61
8.4.110.0120.00922.82
8.4.100.0140.00518.00
8.4.90.0100.01120.68
8.4.80.0140.00519.10
8.4.70.0040.00418.88
8.4.60.0110.00918.89
8.4.50.0130.00622.60
8.4.40.0130.00719.73
8.4.30.0200.00018.86
8.4.20.0090.01219.68
8.4.10.0040.00822.05
8.3.300.0120.00820.67
8.3.290.0130.00918.65
8.3.280.0060.00418.66
8.3.270.0110.00816.82
8.3.260.0130.01017.01
8.3.250.0110.00818.80
8.3.240.0150.00416.78
8.3.230.0140.00516.75
8.3.220.0130.00618.79
8.3.210.0090.01016.59
8.3.200.0040.00516.63
8.3.190.0070.00817.20
8.3.180.0060.00318.48
8.3.170.0030.00617.27
8.3.160.0060.00320.27
8.3.150.0110.00716.99
8.3.140.0040.01416.78
8.3.130.0040.00418.73
8.3.120.0000.00820.73
8.3.110.0060.00320.94
8.3.100.0090.00018.50
8.3.90.0080.00026.77
8.3.80.0080.00316.88
8.3.70.0070.00716.58
8.3.60.0120.00318.47
8.3.50.0070.01420.47
8.3.40.0130.00620.17
8.3.30.0110.00419.09
8.3.20.0000.00824.18
8.3.10.0040.00424.66
8.3.00.0000.00826.16
8.2.300.0150.00720.48
8.2.290.0130.00816.75
8.2.280.0140.00618.68
8.2.270.0110.01117.26
8.2.260.0110.00718.98
8.2.250.0050.00319.23
8.2.240.0090.00618.91
8.2.230.0150.00622.58
8.2.220.0060.00324.06
8.2.210.0070.00026.77
8.2.200.0000.00918.41
8.2.190.0130.00716.63
8.2.180.0120.00625.92
8.2.170.0070.00719.21
8.2.160.0130.00022.96
8.2.150.0050.00325.66
8.2.140.0050.00324.66
8.2.130.0000.00826.16
8.2.120.0000.00826.16
8.2.110.0070.00321.13
8.2.100.0090.00317.97
8.2.90.0030.00619.17
8.2.80.0000.00817.97
8.2.70.0030.00517.88
8.2.60.0060.00318.05
8.2.50.0060.00318.07
8.2.40.0050.00318.26
8.2.30.0080.00018.07
8.2.20.0040.00420.55
8.2.10.0000.00918.25
8.2.00.0000.00719.43
8.1.340.0100.01121.66
8.1.330.0090.01018.63
8.1.320.0130.00816.18
8.1.310.0060.01319.91
8.1.300.0060.00316.34
8.1.290.0060.00330.84
8.1.280.0070.00725.92
8.1.270.0070.00024.66
8.1.260.0070.00026.35
8.1.250.0090.00028.09
8.1.240.0040.00421.21
8.1.230.0040.00817.66
8.1.220.0030.00617.78
8.1.210.0050.00318.77
8.1.200.0060.00317.60
8.1.190.0050.00317.36
8.1.180.0050.00222.07
8.1.170.0040.00418.76
8.1.160.0030.00518.93
8.1.150.0000.00718.83
8.1.140.0040.00417.67
8.1.130.0070.00017.55
8.1.120.0110.00617.68
8.1.110.0100.00717.60
8.1.100.0040.01217.57
8.1.90.0140.00317.79
8.1.80.0160.00017.75
8.1.70.0140.00317.75
8.1.60.0120.00517.80
8.1.50.0090.00917.80
8.1.40.0160.00317.81
8.1.30.0110.00717.79
8.1.20.0190.00017.80
8.1.10.0110.00817.68
8.1.00.0150.00417.79
8.0.300.0000.00918.77
8.0.290.0000.00716.75
8.0.280.0040.00418.48
8.0.270.0040.00417.32
8.0.260.0050.00216.98
8.0.250.0120.00416.98
8.0.240.0140.00017.10
8.0.230.0080.00416.91
8.0.220.0130.00316.96
8.0.210.0050.00517.02
8.0.200.0120.00417.09
8.0.190.0050.01116.97
8.0.180.0080.00517.03
8.0.170.0120.00016.86
8.0.160.0080.00817.08
8.0.150.0000.01416.87
8.0.140.0000.01617.02
8.0.130.0100.00516.89
8.0.120.0100.00517.02
8.0.110.0140.00016.97
8.0.100.0150.00016.93
8.0.90.0140.00016.84
8.0.80.0110.00317.03
8.0.70.0120.00416.97
8.0.60.0150.00017.00
8.0.50.0150.00016.99
8.0.30.0120.00416.99
8.0.20.0080.00816.95
8.0.10.0100.00517.11
7.4.330.0080.00014.29
7.4.320.0100.00616.59
7.4.300.0120.00416.60
7.4.290.0160.00016.60
7.4.280.0160.00016.68
7.4.270.0120.00416.75
7.4.260.0110.00716.61
7.4.250.0140.00416.68
7.4.240.0100.00616.76
7.4.230.0130.00316.57
7.4.220.0140.00016.63
7.4.210.0110.00316.75
7.4.200.0100.00316.58
7.4.190.0050.00916.80
7.4.180.0140.00016.62
7.4.160.0070.00716.70
7.4.150.0000.01016.86
7.4.140.0090.00316.69
7.4.130.0060.00318.39
7.4.120.0040.00418.53
7.4.110.0020.00718.33
7.4.100.0070.00216.63
7.4.90.0100.00216.58
7.4.80.0100.00016.44
7.4.70.0070.00218.34
7.4.60.0060.00316.52
7.4.50.0110.00016.51
7.4.40.0040.00716.54
7.4.30.0090.00016.68
7.4.20.0000.01016.55
7.4.10.0080.00316.70
7.4.00.0000.00816.61

preferences:
40.17 ms | 1300 KiB | 5 Q