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) = [$matches[0] , 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.0080.01320.46
8.4.110.0120.00522.49
8.4.100.0130.00718.75
8.4.90.0120.00820.65
8.4.80.0080.00518.75
8.4.70.0130.00718.95
8.4.60.0120.00918.91
8.4.50.0090.01018.64
8.4.40.0070.01417.84
8.4.30.0160.00318.57
8.4.20.0090.00918.17
8.4.10.0070.00321.33
8.3.250.0120.00718.76
8.3.240.0120.00616.38
8.3.230.0120.00716.73
8.3.220.0140.00418.96
8.3.210.0140.00716.63
8.3.200.0040.00516.73
8.3.190.0080.01217.26
8.3.180.0110.00817.00
8.3.170.0000.01118.84
8.3.160.0070.01117.32
8.3.150.0070.01117.02
8.3.140.0120.00316.77
8.3.130.0050.00318.55
8.3.120.0110.00420.81
8.3.110.0030.00720.94
8.3.100.0090.00018.58
8.3.90.0090.00926.77
8.3.80.0030.00619.36
8.3.70.0150.00416.75
8.3.60.0140.00716.88
8.3.50.0090.01123.67
8.3.40.0130.00022.12
8.3.30.0140.00018.79
8.3.20.0050.00224.18
8.3.10.0000.00824.66
8.3.00.0080.00026.16
8.2.290.0140.00520.48
8.2.280.0110.00918.43
8.2.270.0170.00317.41
8.2.260.0110.00716.72
8.2.250.0130.00616.93
8.2.240.0060.00317.40
8.2.230.0050.00522.58
8.2.220.0090.00024.06
8.2.210.0120.00626.77
8.2.200.0090.00018.88
8.2.190.0120.00617.02
8.2.180.0040.01125.92
8.2.170.0030.01719.25
8.2.160.0060.00922.96
8.2.150.0040.00425.66
8.2.140.0080.00024.66
8.2.130.0000.00826.16
8.2.120.0070.00321.12
8.2.110.0060.00321.17
8.2.100.0040.00817.93
8.2.90.0030.00618.03
8.2.80.0080.00019.08
8.2.70.0060.00317.75
8.2.60.0040.00418.03
8.2.50.0030.00518.05
8.2.40.0030.00518.17
8.2.30.0040.00418.02
8.2.20.0070.00018.03
8.2.10.0040.00419.33
8.2.00.0000.00719.26
8.1.330.0110.00822.04
8.1.320.0120.00716.17
8.1.310.0030.00516.93
8.1.300.0080.00817.92
8.1.290.0060.00330.84
8.1.280.0070.01025.92
8.1.270.0100.00723.79
8.1.260.0060.00326.35
8.1.250.0000.00728.09
8.1.240.0040.00422.09
8.1.230.0080.00320.97
8.1.220.0000.00817.74
8.1.210.0060.00320.55
8.1.200.0100.00017.48
8.1.190.0070.00317.25
8.1.180.0040.00418.10
8.1.170.0050.00318.71
8.1.160.0070.00018.96
8.1.150.0040.00718.93
8.1.140.0040.00418.80
8.1.130.0000.00720.04
8.1.120.0080.00517.55
8.1.110.0110.00217.54
8.1.100.0070.00417.51
8.1.90.0110.00117.61
8.1.80.0080.00317.49
8.1.70.0070.00417.60
8.1.60.0130.00317.67
8.1.50.0110.00517.62
8.1.40.0130.00417.60
8.1.30.0060.01017.72
8.1.20.0100.00517.77
8.1.10.0100.00317.71
8.1.00.0100.00517.61
8.0.300.0040.00420.16
8.0.290.0050.00316.63
8.0.280.0030.00518.53
8.0.270.0000.00718.04
8.0.260.0030.00318.61
8.0.250.0070.00517.06
8.0.240.0050.00817.05
8.0.230.0080.00517.05
8.0.220.0100.00416.98
8.0.210.0090.00516.91
8.0.200.0080.00517.00
8.0.190.0100.00417.09
8.0.180.0110.00316.97
8.0.170.0070.00717.02
8.0.160.0060.00717.04
8.0.150.0110.00216.94
8.0.140.0090.00416.90
8.0.130.0080.00616.07
8.0.120.0090.00416.94
8.0.110.0060.00716.92
8.0.100.0090.00316.92
8.0.90.0070.00616.94
8.0.80.0110.00616.99
8.0.70.0090.00516.88
8.0.60.0090.00417.04
8.0.50.0070.00616.93
8.0.30.0120.00416.97
8.0.20.0090.00917.05
8.0.10.0050.00617.09
8.0.00.0080.00717.03
7.4.330.0000.00615.55
7.4.320.0040.00316.74
7.4.300.0100.00416.78
7.4.290.0130.00216.69
7.4.280.0090.00616.78
7.4.270.0080.00516.75
7.4.260.0110.00215.92
7.4.250.0080.00416.79
7.4.240.0080.00616.75
7.4.230.0090.00416.67
7.4.220.0050.00416.76
7.4.210.0070.00716.77
7.4.200.0120.00216.79
7.4.190.0070.00716.73
7.4.180.0060.00616.76
7.4.160.0100.00516.79
7.4.150.0120.00416.74
7.4.140.0120.00316.78
7.4.130.0090.00916.74
7.4.120.0140.00516.66
7.4.110.0110.00816.68
7.4.100.0100.00816.74
7.4.90.0120.00616.65
7.4.80.0120.00716.60
7.4.70.0120.00716.59
7.4.60.0110.00616.70
7.4.50.0110.00816.67
7.4.40.0110.00816.66
7.4.30.0130.00516.65
7.4.20.0150.00416.67
7.4.10.0170.00316.72
7.4.00.0100.00616.66
7.3.330.0080.00516.44
7.3.320.0070.00615.71
7.3.310.0090.00316.51
7.3.300.0090.00416.42
7.3.290.0110.00516.52
7.3.280.0110.00416.54
7.3.270.0110.00316.53
7.3.260.0130.00316.43
7.3.250.0120.00816.50
7.3.240.0130.00816.48
7.3.230.0120.00716.43
7.3.220.0130.00616.49
7.3.210.0130.00616.51
7.3.200.0120.00716.42
7.3.190.0140.00716.55
7.3.180.0140.00616.55
7.3.170.0120.00816.62
7.3.160.0110.00916.60
7.3.150.0140.00616.44
7.3.140.0150.00816.52
7.3.130.0130.00816.45
7.3.120.0120.00916.46
7.3.110.0170.00416.45
7.3.100.0120.00816.48
7.3.90.0170.00316.71
7.3.80.0090.01016.46
7.3.70.0120.00616.46
7.3.60.0110.00716.54
7.3.50.0080.01116.58
7.3.40.0130.00516.69
7.3.30.0110.00616.53
7.3.20.0160.00416.62
7.3.10.0150.00416.60
7.3.00.0140.00716.52

preferences:
28.87 ms | 403 KiB | 5 Q