3v4l.org

run code in 300+ PHP versions simultaneously
<?php $email = 'email@example.com'; function base64url_encode($str) { return rtrim(strtr(base64_encode($str), '+/', '-_'), '='); } function base64url_decode($str) { return base64_decode(strtr($str, '-_', '+/')); } $token = base64url_encode($email).'.'.hash_hmac('sha256', 'email@example.com', 'secret-server-key'); // mock got token $_GET['token'] = $token; // when checking if (isset($_GET['token'])) { $tok = explode('.', $_GET['token']); // check token parts if (count($tok) !== 2) { // not valid token throw new \Exception('Invalid token!'); } // check email segment if (!isset($tok[0]) || !filter_var(base64url_decode($tok[0]), FILTER_VALIDATE_EMAIL)) { // not valid email throw new \Exception('Invalid token!'); } $email = base64url_decode($tok[0]); if ($tok[1] !== hash_hmac('sha256', $email, 'secret-server-key')) { // failed verification throw new \Exception('Invalid token!'); } // echo 'Its lagit!'; // do somthing with $email }

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.0090.01017.48
8.5.00.0120.01020.23
8.4.150.0020.00014.05
8.4.140.0120.01018.38
8.4.130.0150.00618.64
8.4.120.0120.00921.02
8.4.110.0100.01022.73
8.4.100.0150.00718.36
8.4.90.0130.00919.15
8.4.80.0050.00420.17
8.4.70.0100.01118.58
8.4.60.0140.00919.18
8.4.50.0070.01118.42
8.4.40.0160.00720.00
8.4.30.0100.01120.03
8.4.20.0140.00719.88
8.4.10.0060.00320.11
8.3.280.0130.00818.91
8.3.270.0100.01217.39
8.3.260.0140.00717.18
8.3.250.0120.00819.21
8.3.240.0130.00517.29
8.3.230.0130.00917.04
8.3.220.0120.00817.57
8.3.210.0120.00817.22
8.3.200.0070.00317.05
8.3.190.0120.00817.59
8.3.180.0100.00917.14
8.3.170.0110.00017.17
8.3.160.0160.00318.99
8.3.150.0160.00317.50
8.3.140.0040.00417.63
8.3.130.0090.00017.41
8.3.120.0090.00021.10
8.3.110.0030.00720.94
8.3.100.0100.00022.79
8.3.90.0040.00419.06
8.3.80.0030.00617.97
8.3.70.0150.00719.18
8.3.60.0130.01017.50
8.3.50.0120.00518.05
8.3.40.0080.00819.17
8.3.30.0080.00819.32
8.3.20.0080.00021.99
8.3.10.0080.00024.04
8.3.00.0080.00022.27
8.2.290.0060.00520.71
8.2.280.0030.00620.66
8.2.270.0130.01017.09
8.2.260.0080.00419.12
8.2.250.0090.00618.99
8.2.240.0030.00717.61
8.2.230.0140.00722.58
8.2.220.0000.00924.06
8.2.210.0130.00726.77
8.2.200.0030.00718.79
8.2.190.0030.01217.13
8.2.180.0060.00917.21
8.2.170.0070.01022.96
8.2.160.0170.00320.47
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0080.00021.30
8.2.120.0080.00026.35
8.2.110.0070.00321.45
8.2.100.0120.00018.34
8.2.90.0080.00020.80
8.2.80.0000.00818.43
8.2.70.0090.00018.30
8.2.60.0030.00518.41
8.2.50.0040.00418.13
8.2.40.0000.00818.30
8.2.30.0030.00519.80
8.2.20.0050.00318.55
8.2.10.0040.00418.49
8.2.00.0050.00320.27
8.1.330.0140.00622.39
8.1.320.0120.00916.86
8.1.310.0190.00017.04
8.1.300.0070.01018.48
8.1.290.0030.00618.88
8.1.280.0110.00425.92
8.1.270.0050.00322.62
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00321.53
8.1.230.0070.00721.27
8.1.220.0040.00418.29
8.1.210.0000.00819.41
8.1.200.0060.00318.10
8.1.190.0000.00817.98
8.1.180.0060.00318.10
8.1.170.0050.00517.84
8.1.160.0080.00019.21
8.1.150.0050.00320.52
8.1.140.0030.00619.86
8.1.130.0020.00517.80
8.1.120.0040.00417.73
8.1.110.0000.00817.72
8.1.100.0040.00417.89
8.1.90.0000.00817.67
8.1.80.0060.00317.86
8.1.70.0000.00717.71
8.1.60.0030.00617.86
8.1.50.0000.00817.85
8.1.40.0030.00517.91
8.1.30.0040.00418.01
8.1.20.0060.00317.99
8.1.10.0040.00417.92
8.1.00.0070.01119.90
8.0.300.0080.00020.40
8.0.290.0100.00017.25
8.0.280.0040.00418.65
8.0.270.0040.00417.34
8.0.260.0040.00417.03
8.0.250.0050.00317.28
8.0.240.0050.00317.23
8.0.230.0030.00617.19
8.0.220.0070.00417.31
8.0.210.0000.00817.17
8.0.200.0030.00717.30
8.0.190.0050.00317.21
8.0.180.0030.00517.21
8.0.170.0000.00917.20
8.0.160.0040.00417.16
8.0.150.0000.00817.24
8.0.140.0050.00317.20
8.0.130.0030.00313.65
8.0.120.0030.00617.33
8.0.110.0000.00817.24
8.0.100.0030.00517.14
8.0.90.0000.01017.40
8.0.80.0110.00617.35
8.0.70.0030.00517.13
8.0.60.0080.00017.40
8.0.50.0090.00017.35
8.0.30.0100.01117.48
8.0.20.0100.01017.59
8.0.10.0000.00817.38
8.0.00.0130.00817.23
7.4.330.0050.00215.55
7.4.320.0030.00517.01
7.4.300.0030.00316.94
7.4.290.0070.00316.94
7.4.280.0000.00916.95
7.4.270.0050.00317.05
7.4.260.0020.00516.84
7.4.250.0030.00517.03
7.4.240.0000.00817.07
7.4.230.0040.00417.15
7.4.220.0000.00817.04
7.4.210.0130.01016.99
7.4.200.0030.00617.03
7.4.160.0140.00416.84
7.4.140.0100.01217.86
7.4.130.0160.00317.00
7.4.120.0120.00716.92
7.4.110.0150.00316.91
7.4.100.0140.00316.98
7.4.90.0120.00916.82
7.4.80.0160.00719.39
7.4.70.0060.01216.91
7.4.60.0130.00316.96
7.4.50.0030.01416.91
7.4.40.0160.00316.89
7.4.00.0060.01115.38
7.3.330.0030.00313.73
7.3.320.0000.00613.74
7.3.310.0000.00716.63
7.3.300.0070.00016.77
7.3.290.0100.00516.76
7.3.280.0080.01116.78
7.3.260.0100.01216.91
7.3.240.0110.00716.73
7.3.230.0070.01116.76
7.3.210.0040.01416.63
7.3.200.0060.01217.02
7.3.190.0140.00317.01
7.3.180.0090.00916.93
7.3.170.0060.01416.96
7.3.160.0190.00416.99
7.2.330.0070.01117.08
7.2.320.0060.01317.14
7.2.310.0090.00916.86
7.2.300.0130.01316.85
7.2.290.0090.00916.97
7.2.80.0000.01417.11
7.2.60.0040.00817.36
7.2.30.0070.01220.34
7.2.20.0120.01520.12
7.2.10.0090.01619.94
7.2.00.0100.01420.21
7.1.200.0030.01016.09
7.1.150.0100.01018.57
7.1.140.0110.01218.68
7.1.130.0100.01319.01
7.1.120.0110.01019.06
7.1.110.0110.01218.14
7.1.100.0090.01318.36
7.1.90.0080.01618.32
7.1.80.0080.01118.18
7.1.70.0070.00917.55
7.1.60.0310.01635.69
7.1.50.0270.01135.12
7.1.40.0230.01434.76
7.1.30.0250.01134.89
7.1.20.0190.01634.90
7.1.10.0060.01016.84
7.1.00.0050.01216.96

preferences:
44.4 ms | 403 KiB | 5 Q