3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertHashtags($str) { $regex = '/@([a-zA-Z0-9]+[\sa-zA-Z0-9]*)/'; if(preg_match($regex,$str,$matches) === 1){ list($username,$name) = [$str , strtolower(str_replace(' ','',$matches[1]))]; return "<a href='profile?id=$name'>$username</a>"; } throw new Exception('Unable to find username in the given string'); } $string = 'I am @Marie Lee, nice to meet you!'; $string = convertHashtags($string); echo $string;

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.120.0060.00322.23
8.4.110.0110.00922.44
8.4.100.0110.01018.02
8.4.90.0140.00617.97
8.4.80.0130.00518.16
8.4.70.0100.00919.82
8.4.60.0090.01417.84
8.4.50.0060.00417.91
8.4.40.0190.00619.92
8.4.30.0120.00620.14
8.4.20.0150.00618.15
8.4.10.0100.00021.41
8.3.250.0110.00718.82
8.3.240.0110.00816.61
8.3.230.0120.00816.85
8.3.220.0090.00816.90
8.3.210.0150.00316.66
8.3.200.0110.01016.52
8.3.190.0120.00616.96
8.3.180.0100.00916.54
8.3.170.0110.00718.95
8.3.160.0130.00617.13
8.3.150.0060.00318.86
8.3.140.0120.00616.84
8.3.130.0030.00718.47
8.3.120.0030.00620.86
8.3.110.0030.00620.94
8.3.100.0040.00416.63
8.3.90.0110.00426.77
8.3.80.0080.00419.36
8.3.70.0080.00818.43
8.3.60.0040.01418.56
8.3.50.0140.00324.49
8.3.40.0070.00721.73
8.3.30.0060.00918.58
8.3.20.0000.00724.18
8.3.10.0060.00324.66
8.3.00.0000.00826.16
8.2.290.0140.00420.43
8.2.280.0040.00418.56
8.2.270.0120.00617.02
8.2.260.0150.00418.58
8.2.250.0040.00416.77
8.2.240.0030.00619.08
8.2.230.0040.00422.58
8.2.220.0040.00424.06
8.2.210.0000.00826.77
8.2.200.0060.00318.88
8.2.190.0100.01016.66
8.2.180.0120.00625.92
8.2.170.0040.01119.00
8.2.160.0030.01022.96
8.2.150.0080.00025.66
8.2.140.0070.00024.66
8.2.130.0030.00526.16
8.2.120.0040.00421.23
8.2.110.0060.00322.20
8.2.100.0110.00018.03
8.2.90.0000.00817.88
8.2.80.0040.00418.83
8.2.70.0080.00018.00
8.2.60.0080.00017.75
8.2.50.0030.00518.05
8.2.40.0000.00819.84
8.2.30.0040.00418.03
8.2.20.0040.00418.09
8.2.10.0070.00319.41
8.2.00.0040.00419.28
8.1.330.0120.00821.72
8.1.320.0110.00816.40
8.1.310.0080.00316.83
8.1.300.0100.01016.17
8.1.290.0040.00430.84
8.1.280.0110.00425.92
8.1.270.0080.00023.99
8.1.260.0050.00326.35
8.1.250.0070.00028.09
8.1.240.0060.00320.20
8.1.230.0110.00017.82
8.1.220.0000.00817.74
8.1.210.0000.00918.77
8.1.200.0040.00417.47
8.1.190.0000.00817.48
8.1.180.0030.00618.10
8.1.170.0030.00518.77
8.1.160.0000.00718.97
8.1.150.0000.01019.03
8.1.140.0000.00718.99
8.1.130.0000.00717.59
8.1.120.0030.00617.60
8.1.110.0000.00717.55
8.1.100.0030.00517.64
8.1.90.0040.00417.52
8.1.80.0000.00717.59
8.1.70.0070.00017.66
8.1.60.0030.00617.73
8.1.50.0030.00617.68
8.1.40.0060.00317.65
8.1.30.0060.00317.82
8.1.20.0000.00817.71
8.1.10.0100.00017.68
8.1.00.0120.00717.56
8.0.300.0040.00418.87
8.0.290.0070.00016.75
8.0.280.0030.00318.48
8.0.270.0020.00518.17
8.0.260.0050.00317.02
8.0.250.0000.00717.07
8.0.240.0030.00317.01
8.0.230.0080.00017.13
8.0.220.0040.00417.08
8.0.210.0060.00316.92
8.0.200.0000.00717.04
8.0.190.0000.00717.05
8.0.180.0040.00417.05
8.0.170.0080.00017.12
8.0.160.0070.00017.00
8.0.150.0000.00716.97
8.0.140.0150.00116.83
8.0.130.0070.00715.26
8.0.120.0100.00416.89
8.0.110.0100.00416.87
8.0.100.0090.00516.94
8.0.90.0130.00216.98
8.0.80.0140.00717.01
8.0.70.0110.00516.86
8.0.60.0100.00416.97
8.0.50.0120.00216.94
8.0.30.0110.00617.24
8.0.20.0130.00717.18
8.0.10.0080.00617.15
8.0.00.0030.01416.88
7.4.330.0000.00515.55
7.4.320.0030.00316.78
7.4.300.0040.00416.66
7.4.290.0030.00616.78
7.4.280.0090.00016.61
7.4.270.0120.00216.77
7.4.260.0110.00315.06
7.4.250.0090.00516.76
7.4.240.0060.00816.71
7.4.230.0050.00516.64
7.4.220.0070.00316.78
7.4.210.0050.01016.73
7.4.200.0070.00716.68
7.4.190.0120.00816.59
7.4.180.0140.00616.79
7.4.160.0160.00316.77
7.4.150.0090.00916.59
7.4.140.0120.00716.62
7.4.130.0150.00416.58
7.4.120.0190.00216.56
7.4.110.0090.00916.68
7.4.100.0080.00916.71
7.4.90.0150.00316.81
7.4.80.0110.00816.72
7.4.70.0160.00516.58
7.4.60.0120.00916.73
7.4.50.0150.00516.59
7.4.40.0100.01016.54
7.4.30.0130.00416.65
7.4.20.0100.00816.52
7.4.10.0130.00616.64
7.4.00.0130.00616.57
7.3.330.0060.00716.43
7.3.320.0040.00614.99
7.3.310.0070.00316.49
7.3.300.0100.00316.39
7.3.290.0060.01016.48
7.3.280.0150.00416.39
7.3.270.0100.00616.46
7.3.260.0130.00616.57
7.3.250.0110.00616.52
7.3.240.0110.00916.47
7.3.230.0130.00616.64
7.3.220.0100.00816.60
7.3.210.0120.00516.61
7.3.200.0090.00816.44
7.3.190.0090.01016.66
7.3.180.0130.00516.60
7.3.170.0140.00616.34
7.3.160.0180.00416.51
7.3.150.0150.00416.36
7.3.140.0140.00416.36
7.3.130.0140.00516.50
7.3.120.0130.00616.48
7.3.110.0120.00616.22
7.3.100.0140.00416.26
7.3.90.0110.00816.62
7.3.80.0130.00616.57
7.3.70.0140.00516.51
7.3.60.0110.00716.57
7.3.50.0120.00716.58
7.3.40.0150.00316.59
7.3.30.0100.00816.62
7.3.20.0110.00716.46
7.3.10.0240.00816.51
7.3.00.0150.00416.55

preferences:
31 ms | 403 KiB | 5 Q