3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base64Url { /** * @param $str string * * @return string */ public static function encode($str) { $std = @base64_encode($str); if ($std === false) { throw new \Exception('base64_encode() failed'); } return rtrim(strtr($std, '+/', '-_'), '='); } /** * @param $str string * * @return string */ public static function decode($str) { $result = ''; if ($str !== null) { if (!is_string($str)) { throw new \Exception('Only strings can be decoded'); } $std = strtr($str, '-_', '+/').str_repeat('=', strlen($str) % 4); $result = base64_decode($std, true); if ($result === false) { throw new \Exception('base64_decode() failed'); } } return $result; } } $ph = '{"typ":"JWT",' . "\n ". '"alg":"HS256"}'; echo Base64Url::decode(Base64Url::encode($ph));

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.3.60.0120.00916.63
8.3.50.0110.01116.58
8.3.40.0040.01118.72
8.3.30.0140.00018.71
8.3.20.0000.00820.16
8.3.10.0070.00021.73
8.3.00.0050.00323.57
8.2.180.0150.00318.29
8.2.170.0030.01422.96
8.2.160.0030.01020.52
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0080.00019.66
8.2.120.0000.00726.35
8.2.110.0070.00322.24
8.2.100.0080.00317.93
8.2.90.0000.00819.27
8.2.80.0000.00818.05
8.2.70.0060.00317.75
8.2.60.0040.00417.93
8.2.50.0040.00418.07
8.2.40.0030.00622.33
8.2.30.0070.00019.51
8.2.20.0040.00417.77
8.2.10.0070.00018.15
8.2.00.0000.00818.24
8.1.280.0140.00325.92
8.1.270.0140.00020.35
8.1.260.0050.00328.09
8.1.250.0040.00428.09
8.1.240.0060.00323.98
8.1.230.0000.01119.09
8.1.220.0080.00017.74
8.1.210.0090.00018.77
8.1.200.0030.00617.35
8.1.190.0030.00617.23
8.1.180.0000.00818.10
8.1.170.0050.00318.59
8.1.160.0050.00320.82
8.1.150.0070.00018.87
8.1.140.0040.00419.56
8.1.130.0080.00017.72
8.1.120.0040.00417.46
8.1.110.0040.00417.53
8.1.100.0000.00817.37
8.1.90.0040.00417.41
8.1.80.0070.00017.45
8.1.70.0000.00717.39
8.1.60.0050.00317.62
8.1.50.0080.00017.43
8.1.40.0050.00317.57
8.1.30.0040.00417.63
8.1.20.0040.00417.60
8.1.10.0040.00417.48
8.1.00.0040.00417.55
8.0.300.0040.00418.77
8.0.290.0000.00816.75
8.0.280.0030.00318.39
8.0.270.0050.00317.13
8.0.260.0000.00617.28
8.0.250.0000.00717.02
8.0.240.0040.00416.93
8.0.230.0030.00516.94
8.0.220.0000.00816.92
8.0.210.0080.00017.06
8.0.200.0000.00716.93
8.0.190.0090.00317.01
8.0.180.0000.00716.97
8.0.170.0050.00316.84
8.0.160.0070.00017.05
8.0.150.0000.00716.94
8.0.140.0030.00416.90
8.0.130.0030.00313.45
8.0.120.0040.00416.97
8.0.110.0000.00716.97
8.0.100.0030.00517.00
8.0.90.0030.00316.84
8.0.80.0070.01016.98
8.0.70.0030.00517.02
8.0.60.0000.00716.80
8.0.50.0000.00916.94
8.0.30.0100.00717.00
8.0.20.0110.00817.40
8.0.10.0050.00317.13
8.0.00.0110.01016.95
7.4.330.0000.00516.67
7.4.320.0070.00016.55
7.4.300.0040.00416.54
7.4.290.0040.00416.44
7.4.280.0000.00816.54
7.4.270.0000.00716.64
7.4.260.0000.00716.65
7.4.250.0050.00316.50
7.4.240.0000.00816.50
7.4.230.0030.00616.57
7.4.220.0060.01416.57
7.4.210.0130.00716.56
7.4.200.0000.00716.65
7.4.160.0090.00616.66
7.4.150.0100.00717.40
7.4.140.0110.01017.86
7.4.130.0130.00916.50
7.4.120.0060.01416.44
7.4.110.0030.01316.61
7.4.100.0070.01516.54
7.4.90.0120.00616.72
7.4.80.0120.01019.39
7.4.70.0130.01016.55
7.4.60.0040.01216.50
7.4.50.0060.00916.63
7.4.40.0070.01116.55
7.4.30.0100.00716.46
7.4.00.0090.00614.57
7.3.330.0030.00313.41
7.3.320.0030.00313.39
7.3.310.0000.00816.48
7.3.300.0070.00016.31
7.3.290.0060.00916.42
7.3.280.0060.01016.46
7.3.270.0090.00917.40
7.3.260.0030.01616.79
7.3.250.0090.00716.52
7.3.240.0050.01316.43
7.3.230.0110.00616.59
7.3.210.0030.01416.50
7.3.200.0040.01219.39
7.3.190.0060.01016.56
7.3.180.0110.00616.46
7.3.170.0080.00816.46
7.3.160.0090.00816.38
7.2.330.0070.01016.73
7.2.320.0100.01316.47
7.2.310.0120.00916.77
7.2.300.0060.01216.56
7.2.290.0090.00916.73
7.2.60.0000.01316.95
7.2.50.0120.00616.90
7.2.00.0070.01019.46
7.1.200.0000.00715.86
7.1.100.0000.00818.11
7.1.70.0070.00317.26
7.1.60.0090.01519.27
7.1.50.0040.01117.03
7.1.00.0030.07722.40
7.0.200.0000.00716.65
7.0.60.0030.03021.82
7.0.50.0100.05317.89
7.0.40.0030.06720.14
7.0.30.0300.05320.09
7.0.20.0300.08020.30
7.0.10.0030.05320.20
7.0.00.0100.04020.27
5.6.210.0200.06020.76
5.6.200.0100.08318.15
5.6.190.0170.07320.57
5.6.180.0330.07720.58
5.6.170.0170.04020.71
5.6.160.0030.09020.55
5.6.150.0100.04318.16
5.6.140.0100.04318.18
5.6.130.0100.07318.24
5.6.120.0070.04721.00
5.6.110.0000.04321.12
5.6.100.0130.06020.98
5.6.90.0070.06321.00
5.6.80.0030.04320.40
5.5.350.3830.03320.47
5.5.340.0070.08017.96
5.5.330.0130.08720.38
5.5.320.0500.04320.37
5.5.310.0170.04020.30
5.5.300.0200.06717.97
5.5.290.0100.07318.08
5.5.280.0200.07320.81
5.5.270.0030.07320.88
5.5.260.0030.04320.85
5.5.250.0130.07320.51
5.5.240.0230.07020.29

preferences:
47.63 ms | 400 KiB | 5 Q