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($data, '-_', '+/').str_repeat('=', strlen($data) % 4); $result = base64_decode($std, true); if ($result === false) { throw new \Exception('base64_decode() failed'); } } return $result; } } $ph = '{"typ":"JWT","alg":"HS256"}'; echo 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.0070.00718.43
8.3.50.0140.00716.37
8.3.40.0110.00318.55
8.3.30.0110.00418.72
8.3.20.0040.00420.29
8.3.10.0040.00421.87
8.3.00.0060.00323.65
8.2.180.0110.01116.47
8.2.170.0040.01122.96
8.2.160.0070.00720.39
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00419.64
8.2.120.0040.00426.35
8.2.110.0060.00321.93
8.2.100.0120.00017.93
8.2.90.0090.00019.21
8.2.80.0040.00418.04
8.2.70.0030.00617.50
8.2.60.0000.00717.80
8.2.50.0030.00518.07
8.2.40.0080.00022.15
8.2.30.0000.00719.52
8.2.20.0000.00717.58
8.2.10.0040.00418.17
8.2.00.0000.00718.13
8.1.280.0230.00025.92
8.1.270.0070.00720.38
8.1.260.0080.00028.09
8.1.250.0060.00328.09
8.1.240.0030.00723.83
8.1.230.0040.00818.97
8.1.220.0040.00417.74
8.1.210.0030.00618.77
8.1.200.0030.00617.38
8.1.190.0000.00817.10
8.1.180.0050.00318.10
8.1.170.0030.00618.59
8.1.160.0070.00020.68
8.1.150.0040.00418.75
8.1.140.0040.00419.57
8.1.130.0000.00717.72
8.1.120.0000.00717.39
8.1.110.0000.00717.33
8.1.100.0070.00017.54
8.1.90.0000.00717.55
8.1.80.0040.00417.47
8.1.70.0030.00317.53
8.1.60.0040.00417.60
8.1.50.0030.00617.55
8.1.40.0040.00417.48
8.1.30.0040.00417.64
8.1.20.0040.00417.71
8.1.10.0000.00717.58
8.1.00.0080.00017.54
8.0.300.0070.00018.77
8.0.290.0060.00316.75
8.0.280.0000.00818.41
8.0.270.0000.00717.27
8.0.260.0000.00717.27
8.0.250.0030.00316.99
8.0.240.0000.00817.04
8.0.230.0030.00316.96
8.0.220.0000.00716.83
8.0.210.0030.00516.79
8.0.200.0000.00716.85
8.0.190.0100.00016.93
8.0.180.0040.00416.84
8.0.170.0050.00316.96
8.0.160.0070.00016.98
8.0.150.0070.00016.83
8.0.140.0070.00016.75
8.0.130.0030.00313.38
8.0.120.0060.00316.78
8.0.110.0070.00016.82
8.0.100.0040.00416.78
8.0.90.0040.00416.71
8.0.80.0070.01016.90
8.0.70.0040.00417.01
8.0.60.0000.00816.77
8.0.50.0040.00416.90
8.0.30.0120.00417.04
8.0.20.0060.01317.40
8.0.10.0000.00816.91
8.0.00.0130.00616.82
7.4.330.0000.00516.71
7.4.320.0030.00316.66
7.4.300.0030.00316.63
7.4.290.0000.00716.53
7.4.280.0000.00816.52
7.4.270.0000.00716.43
7.4.260.0030.00316.63
7.4.250.0080.00016.50
7.4.240.0050.00216.55
7.4.230.0030.00316.42
7.4.220.0140.00716.55
7.4.210.0040.01216.56
7.4.200.0000.00716.54
7.4.160.0090.00616.59
7.4.150.0070.01017.40
7.4.140.0070.01117.86
7.4.130.0060.01416.47
7.4.120.0110.00716.44
7.4.110.0140.00616.58
7.4.100.0070.01716.54
7.4.90.0050.01416.46
7.4.80.0080.01319.39
7.4.70.0090.00916.37
7.4.60.0030.01216.32
7.4.50.0140.00016.55
7.4.40.0100.01016.41
7.4.30.0080.00916.49
7.4.00.0060.00614.87
7.3.330.0030.00313.24
7.3.320.0000.00513.18
7.3.310.0030.00316.21
7.3.300.0000.00716.33
7.3.290.0090.00816.32
7.3.280.0060.01316.35
7.3.270.0030.01417.40
7.3.260.0080.00916.56
7.3.250.0100.00716.38
7.3.240.0130.00616.30
7.3.230.0130.00616.50
7.3.210.0150.00316.48
7.3.200.0000.01719.39
7.3.190.0080.01116.45
7.3.180.0070.01016.36
7.3.170.0070.01316.64
7.3.160.0000.01616.52
7.3.10.0070.01016.55
7.3.00.0040.00716.67
7.2.330.0150.00316.78
7.2.320.0070.01116.77
7.2.310.0160.00616.86
7.2.300.0040.01316.63
7.2.290.0070.01516.42
7.2.130.0110.00416.95
7.2.120.0070.00717.01
7.2.110.0070.01316.91
7.2.100.0040.00416.94
7.2.90.0060.01017.09
7.2.80.0070.00316.74
7.2.70.0060.00616.70
7.2.60.0050.00916.85
7.2.50.0000.00916.79
7.2.40.0060.00916.73
7.2.30.0040.01116.90
7.2.20.0060.00917.00
7.2.10.0080.00316.75
7.2.00.0080.00518.01
7.1.250.0000.01015.64
7.1.200.0090.00615.56
7.1.100.0070.01118.14
7.1.70.0040.00716.92
7.1.60.0110.01519.27
7.1.50.0230.01334.79
7.1.00.0070.07322.42
7.0.200.0000.01016.75
7.0.60.0100.07721.83
7.0.50.0170.07017.89
7.0.40.0070.06020.14
7.0.30.0200.06720.16
7.0.20.0300.06320.06
7.0.10.0100.07020.03
7.0.00.0100.03720.07
5.6.280.0000.04721.03
5.6.210.0300.06320.57
5.6.200.0000.08718.18
5.6.190.0100.08020.52
5.6.180.0230.04320.39
5.6.170.0270.03320.49
5.6.160.0030.08720.47
5.6.150.0130.07318.19
5.6.140.0030.04718.18
5.6.130.0030.07018.20
5.6.120.0030.06020.90
5.6.110.0170.07320.96
5.6.100.0030.06021.02
5.6.90.0030.04320.97
5.6.80.0100.03320.38
5.5.350.0000.08320.46
5.5.340.0100.07018.02
5.5.330.0030.05020.48
5.5.320.0470.04020.27
5.5.310.0200.04720.30
5.5.300.0070.07318.08
5.5.290.0070.05317.95
5.5.280.0070.08720.84
5.5.270.0030.09020.78
5.5.260.0000.09020.87
5.5.250.0070.07320.71
5.5.240.0200.06320.20

preferences:
58.74 ms | 400 KiB | 5 Q