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::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.0110.00416.38
8.3.50.0060.01121.27
8.3.40.0120.00618.39
8.3.30.0060.00918.33
8.3.20.0070.00020.19
8.3.10.0050.00321.69
8.3.00.0050.00323.33
8.2.180.0180.00416.50
8.2.170.0090.00622.96
8.2.160.0080.00620.29
8.2.150.0050.00324.18
8.2.140.0050.00224.66
8.2.130.0070.00019.83
8.2.120.0070.00026.35
8.2.110.0040.00422.31
8.2.100.0090.00318.04
8.2.90.0080.00019.22
8.2.80.0000.00817.97
8.2.70.0000.00817.63
8.2.60.0060.00317.93
8.2.50.0040.00418.07
8.2.40.0080.00022.14
8.2.30.0040.00419.44
8.2.20.0040.00417.70
8.2.10.0030.00518.01
8.2.00.0000.00718.18
8.1.280.0120.00325.92
8.1.270.0110.00420.41
8.1.260.0040.00428.09
8.1.250.0070.00028.09
8.1.240.0090.00023.85
8.1.230.0060.00619.13
8.1.220.0050.00317.79
8.1.210.0030.00618.77
8.1.200.0030.00617.22
8.1.190.0040.00417.22
8.1.180.0050.00318.10
8.1.170.0050.00318.46
8.1.160.0040.00420.84
8.1.150.0000.00718.82
8.1.140.0000.00919.60
8.1.130.0030.00317.72
8.1.120.0070.00017.48
8.1.110.0000.00717.43
8.1.100.0050.00317.45
8.1.90.0040.00417.39
8.1.80.0000.00817.39
8.1.70.0030.00317.48
8.1.60.0060.00317.49
8.1.50.0040.00417.58
8.1.40.0000.00817.44
8.1.30.0080.00017.56
8.1.20.0040.00417.75
8.1.10.0000.00717.59
8.1.00.0080.00017.52
8.0.300.0040.00418.77
8.0.290.0000.00716.75
8.0.280.0070.00018.36
8.0.270.0000.00717.27
8.0.260.0060.00017.25
8.0.250.0070.00017.04
8.0.240.0000.00717.01
8.0.230.0000.00817.02
8.0.220.0000.00816.93
8.0.210.0070.00016.89
8.0.200.0030.00317.00
8.0.190.0110.00016.98
8.0.180.0000.00716.77
8.0.170.0050.00316.90
8.0.160.0040.00416.81
8.0.150.0000.00716.89
8.0.140.0030.00316.77
8.0.130.0030.00313.36
8.0.120.0070.00016.81
8.0.110.0040.00416.80
8.0.100.0000.00716.85
8.0.90.0040.00416.89
8.0.80.0180.00016.83
8.0.70.0040.00416.89
8.0.60.0040.00416.81
8.0.50.0080.00016.76
8.0.30.0120.00517.06
8.0.20.0110.00817.42
8.0.10.0040.00416.89
8.0.00.0090.01216.78
7.4.330.0000.00616.75
7.4.320.0030.00516.51
7.4.300.0030.00316.64
7.4.290.0000.00716.43
7.4.280.0040.00416.43
7.4.270.0000.00716.61
7.4.260.0070.00016.41
7.4.250.0040.00416.47
7.4.240.0000.00716.63
7.4.230.0070.00016.65
7.4.220.0160.00316.53
7.4.210.0070.00716.73
7.4.200.0070.00016.42
7.4.160.0080.00816.57
7.4.150.0090.00917.40
7.4.140.0100.00817.86
7.4.130.0060.01216.56
7.4.120.0110.00816.55
7.4.110.0120.00616.68
7.4.100.0060.01616.41
7.4.90.0100.01316.43
7.4.80.0120.01219.39
7.4.70.0100.00916.65
7.4.60.0040.01116.52
7.4.50.0060.01216.62
7.4.40.0030.01316.48
7.4.30.0000.01616.51
7.4.00.0070.00714.64
7.3.330.0030.00313.18
7.3.320.0000.00613.32
7.3.310.0070.00016.34
7.3.300.0000.00716.28
7.3.290.0100.00616.28
7.3.280.0040.01516.31
7.3.270.0100.00717.40
7.3.260.0130.01016.44
7.3.250.0080.00816.44
7.3.240.0070.01116.36
7.3.230.0120.00616.50
7.3.210.0000.01816.59
7.3.200.0100.00719.39
7.3.190.0030.01216.40
7.3.180.0100.00616.59
7.3.170.0110.00416.46
7.3.160.0070.01016.51
7.3.120.0030.01014.78
7.3.110.0100.00714.67
7.3.100.0030.01314.71
7.3.90.0040.01115.04
7.3.80.0060.00314.75
7.3.70.0030.00614.84
7.3.60.0070.00314.71
7.3.50.0030.00614.66
7.3.40.0130.00314.61
7.3.30.0060.00614.85
7.3.20.0070.01016.34
7.3.10.0100.00516.52
7.3.00.0070.00716.35
7.2.330.0070.01016.64
7.2.320.0060.00916.66
7.2.310.0060.01116.82
7.2.300.0100.01016.54
7.2.290.0060.01316.58
7.2.240.0030.01015.04
7.2.230.0100.00314.86
7.2.220.0100.00014.75
7.2.210.0040.01114.99
7.2.200.0090.00614.67
7.2.190.0100.00315.11
7.2.180.0070.00715.07
7.2.170.0030.01314.93
7.2.160.0030.01215.16
7.2.150.0120.00317.02
7.2.140.0000.01116.89
7.2.130.0070.00716.95
7.2.120.0080.00916.79
7.2.110.0060.00816.71
7.2.100.0070.00816.82
7.2.90.0120.00616.75
7.2.80.0050.00816.78
7.2.70.0090.00816.80
7.2.60.0070.00816.75
7.2.50.0070.01016.67
7.2.40.0040.01116.62
7.2.30.0050.00916.77
7.2.20.0040.01016.90
7.2.10.0070.00716.85
7.2.00.0060.00717.34
7.1.330.0070.00716.03
7.1.320.0030.01015.95
7.1.310.0040.01115.77
7.1.300.0070.00715.73
7.1.290.0030.00915.83
7.1.280.0070.00415.77
7.1.270.0000.01115.84
7.1.260.0060.00815.89
7.1.250.0050.00915.74
7.1.240.0110.00715.90
7.1.230.0040.01115.78
7.1.220.0200.00315.72
7.1.210.0090.00915.79
7.1.200.0080.00515.86
7.1.190.0160.00315.77
7.1.180.0140.00315.67
7.1.170.0110.00315.83
7.1.160.0100.00715.63
7.1.150.0060.00915.98
7.1.140.0030.01015.62
7.1.130.0070.00715.89
7.1.120.0000.00915.68
7.1.110.0000.01316.00
7.1.100.0060.00617.04
7.1.90.0030.01315.98
7.1.80.0070.00715.89
7.1.70.0100.00416.44
7.1.60.0100.00817.61
7.1.50.0110.01225.33
7.1.40.0030.01015.69
7.1.30.0000.00715.82
7.1.20.0030.01015.75
7.1.10.0100.00315.87
7.1.00.0060.04019.10
7.0.320.0110.00715.23
7.0.310.0040.01215.46
7.0.300.0130.00315.13
7.0.290.0040.00415.32
7.0.280.0040.01115.24
7.0.270.0050.00315.37
7.0.260.0060.00615.27
7.0.250.0060.00915.09
7.0.240.0030.01015.58
7.0.230.0120.00015.57
7.0.220.0060.00615.32
7.0.210.0030.00915.14
7.0.200.0050.00415.84
7.0.190.0070.00315.34
7.0.180.0060.00615.30
7.0.170.0100.00315.41
7.0.160.0060.00615.44
7.0.150.0030.00715.53
7.0.140.0080.00315.20
7.0.130.0000.01015.33
7.0.120.0060.00615.42
7.0.110.0080.00415.43
7.0.100.0030.00915.42
7.0.90.0000.01215.56
7.0.80.0030.00715.39
7.0.70.0080.00015.11
7.0.60.0060.04418.60
7.0.50.0060.02916.73
7.0.40.0060.02616.86
7.0.30.0130.02316.88
7.0.20.0170.03816.82
7.0.10.0100.04216.84
7.0.00.0020.02516.71
5.6.380.0160.00014.63
5.6.370.0030.00914.32
5.6.360.0110.00414.31
5.6.350.0100.00314.10
5.6.340.0000.01414.21
5.6.330.0070.00714.56
5.6.320.0060.00714.30
5.6.310.0130.00014.64
5.6.300.0080.00414.01
5.6.290.0070.00014.44
5.6.280.0030.02917.58
5.6.270.0040.00814.11
5.6.260.0030.01014.44
5.6.250.0040.00814.25
5.6.240.0070.00714.09
5.6.230.0070.00714.23
5.6.220.0030.00914.29
5.6.210.0050.02817.59
5.6.200.0070.04216.09
5.6.190.0050.04317.51
5.6.180.0200.02017.50
5.6.170.0080.02817.39
5.6.160.0040.04517.36
5.6.150.0050.04516.32
5.6.140.0030.02616.18
5.6.130.0020.02916.21
5.6.120.0070.02417.53
5.6.110.0120.04217.56
5.6.100.0090.04317.68
5.6.90.0050.03417.69
5.6.80.0070.02017.39
5.6.70.0040.00714.23
5.6.60.0080.00314.22
5.6.50.0000.01714.21
5.6.40.0030.01014.08
5.6.30.0030.00614.13
5.6.20.0100.00314.34
5.6.10.0090.00314.58
5.6.00.0060.00314.22
5.5.380.0050.00511.39
5.5.370.0150.00011.02
5.5.360.0120.00311.09
5.5.350.0070.04215.91
5.5.340.0090.02114.73
5.5.330.0100.04015.77
5.5.320.0340.03015.83
5.5.310.0070.04715.65
5.5.300.0080.04214.65
5.5.290.0070.03314.64
5.5.280.0080.04216.00
5.5.270.0110.03916.13
5.5.260.0150.03016.12
5.5.250.0040.03715.74
5.5.240.0070.04115.63
5.5.230.0040.00811.34
5.5.220.0050.00511.29
5.5.210.0060.00711.29
5.5.200.0080.00511.10
5.5.190.0050.00811.02
5.5.180.0110.00411.19
5.5.170.0000.01314.29
5.5.160.0070.00711.25
5.5.150.0080.00510.95
5.5.140.0150.00011.29
5.5.130.0100.00011.26
5.5.120.0140.00011.33
5.5.110.0100.00211.24
5.5.100.0000.01111.00
5.5.90.0080.00411.31
5.5.80.0080.00411.11
5.5.70.0100.00711.19
5.5.60.0080.00410.98
5.5.50.0060.00811.26
5.5.40.0090.00310.97
5.5.30.0060.00611.02
5.5.20.0040.01111.25
5.5.10.0120.00310.95
5.5.00.0080.00011.25

preferences:
46.23 ms | 401 KiB | 5 Q