3v4l.org

run code in 300+ PHP versions simultaneously
<?php $str = ' I love [123] and [124] at (456). I hate [234] and [235] at (123).'; $table1Col1=["123" => "a", "124" => "b", "234" => "c", "235" => "d"]; $table1Col2 = ["456" => "XX", "123" => "ZZ"]; $pattern = "/\[(\d+)]|\((\d+)\)/"; $result = preg_replace_callback($pattern, function($match) use ($table1Col1, $table1Col2) { return sprintf('<a title="%s">%s</a>', array_key_exists(2, $match) ? $table1Col2[$match[2]] : $table1Col1[$match[1]] , $match[0] ); }, $str); echo $result;

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.0140.00717.03
8.5.00.0130.00920.38
8.4.150.0030.00014.05
8.4.140.0140.00717.80
8.4.130.0130.00818.61
8.4.120.0100.01024.20
8.4.110.0120.00419.11
8.4.100.0080.01118.96
8.4.90.0100.01020.68
8.4.80.0140.00720.44
8.4.70.0070.00218.80
8.4.60.0050.00320.49
8.4.50.0110.00318.62
8.4.40.0060.00317.83
8.4.30.0000.01020.52
8.4.20.0140.01118.07
8.4.10.0030.00617.73
8.3.280.0110.00918.54
8.3.270.0050.01416.86
8.3.260.0110.00916.75
8.3.250.0130.00518.71
8.3.240.0130.00617.22
8.3.230.0080.00716.70
8.3.220.0140.00518.86
8.3.210.0120.00716.64
8.3.200.0040.00516.80
8.3.190.0050.00317.17
8.3.180.0110.00818.92
8.3.170.0100.00717.22
8.3.160.0030.00616.99
8.3.150.0180.00016.86
8.3.140.0090.00916.69
8.3.130.0000.00818.67
8.3.120.0060.00320.86
8.3.110.0100.01020.94
8.3.100.0080.00316.69
8.3.90.0170.00326.77
8.3.80.0070.00319.36
8.3.70.0060.00916.75
8.3.60.0060.01016.75
8.3.50.0140.00418.29
8.3.40.0070.00718.92
8.3.30.0090.00618.80
8.3.20.0030.00524.18
8.3.10.0000.00724.66
8.3.00.0080.00026.16
8.2.290.0050.00320.63
8.2.280.0040.00518.83
8.2.270.0060.01318.70
8.2.260.0150.00417.29
8.2.250.0110.01117.11
8.2.240.0000.00917.24
8.2.230.0100.00722.58
8.2.220.0060.00324.06
8.2.210.0110.00726.77
8.2.200.0060.00318.88
8.2.190.0100.01018.66
8.2.180.0110.00425.92
8.2.170.0040.01118.95
8.2.160.0140.00022.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0060.00321.00
8.2.110.0060.00319.34
8.2.100.0040.00718.09
8.2.90.0030.00619.17
8.2.80.0080.00017.97
8.2.70.0000.00817.75
8.2.60.0060.00317.93
8.2.50.0040.00418.07
8.2.40.0000.00918.29
8.2.30.0070.00018.16
8.2.20.0000.00718.30
8.2.10.0030.00619.26
8.2.00.0000.00719.45
8.1.330.0110.00821.96
8.1.320.0090.00918.41
8.1.310.0080.00016.76
8.1.300.0030.01320.34
8.1.290.0070.00330.84
8.1.280.0030.01225.92
8.1.270.0050.00323.99
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0150.00323.90
8.1.230.0090.00322.72
8.1.220.0050.00317.77
8.1.210.0040.00418.77
8.1.200.0030.00617.60
8.1.190.0040.00417.48
8.1.180.0030.00618.10
8.1.170.0040.00418.72
8.1.160.0030.00518.93
8.1.150.0000.00818.96
8.1.140.0050.00318.89
8.1.130.0030.00320.03
8.1.120.0030.00717.59
8.1.110.0000.00817.50
8.1.100.0040.00417.51
8.1.90.0040.00417.64
8.1.80.0000.00717.62
8.1.70.0040.00417.54
8.1.60.0030.00517.80
8.1.50.0000.00817.71
8.1.40.0060.00617.73
8.1.30.0030.00617.71
8.1.20.0000.00917.73
8.1.10.0030.00517.73
8.1.00.0000.00817.64
8.0.300.0050.00318.77
8.0.290.0030.00616.88
8.0.280.0040.00418.53
8.0.270.0040.00418.23
8.0.260.0000.00818.42
8.0.250.0000.00717.16
8.0.240.0000.00717.15
8.0.230.0000.00716.95
8.0.220.0030.00316.95
8.0.210.0000.00717.09
8.0.200.0000.00717.14
8.0.190.0040.00416.98
8.0.180.0040.00817.08
8.0.170.0030.00517.00
8.0.160.0000.00817.05
8.0.150.0040.00416.98
8.0.140.0000.00717.03
8.0.130.0030.00313.57
8.0.120.0030.00817.03
8.0.110.0030.00517.05
8.0.100.0040.00417.12
8.0.90.0050.00316.91
8.0.80.0060.00917.04
8.0.70.0070.00016.89
8.0.60.0000.00917.16
8.0.50.0040.00417.00
8.0.30.0100.00716.99
8.0.20.0000.01717.12
8.0.10.0130.00417.16
8.0.00.0130.01017.19
7.4.330.0050.00015.55
7.4.320.0060.00016.75
7.4.300.0000.00616.75
7.4.290.0000.00716.59
7.4.280.0040.00416.82
7.4.270.0000.00716.73
7.4.260.0030.00313.59
7.4.250.0070.00016.79
7.4.240.0000.00716.84
7.4.230.0000.00716.85
7.4.220.0060.00116.68
7.4.210.0040.01016.86
7.4.200.0050.00216.63
7.4.160.0060.00916.88
7.4.150.0070.01016.75
7.4.140.0130.00316.69
7.4.130.0140.00416.84
7.4.120.0190.00416.82
7.4.110.0060.01116.61
7.4.100.0070.01016.77
7.4.90.0030.01216.69
7.4.80.0030.01316.79
7.4.70.0130.00616.68
7.4.60.0000.01716.64
7.4.50.0090.01216.71
7.4.40.0060.01516.68
7.4.30.0030.01516.80
7.4.20.0100.01316.71
7.4.10.0090.00616.60
7.4.00.0160.00616.73
7.3.330.0030.00316.41
7.3.320.0050.00013.54
7.3.310.0030.00316.58
7.3.300.0000.00616.38
7.3.290.0070.01216.49
7.3.270.0040.01116.46
7.3.260.0090.01316.47
7.3.250.0070.01016.46
7.3.240.0060.00916.47
7.3.230.0090.01116.47
7.3.220.0030.01216.45
7.3.210.0040.01116.54
7.3.200.0060.01316.44
7.3.190.0140.00716.52
7.3.180.0090.00916.42
7.3.170.0100.01016.46
7.3.160.0170.00316.39
7.3.150.0100.01316.48
7.3.140.0080.00616.45
7.3.130.0070.00716.42
7.3.120.0090.00916.39
7.3.110.0090.01016.39
7.3.100.0070.01416.41
7.3.90.0060.01516.77
7.3.80.0160.00516.45
7.3.70.0090.01216.56
7.3.60.0100.01016.67
7.3.50.0080.00916.63
7.3.40.0070.01016.64
7.3.30.0080.00716.69
7.3.20.0090.00616.66
7.3.10.0040.01516.58
7.3.00.0250.01116.60

preferences:
18.27 ms | 403 KiB | 5 Q