3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CRYPTO{ const TZ = 'UTC'; const TIMEFRAME = 100; const TIME = 'H:i:s'; public static function ver($data, $signature, $privateKey, $timestamp){ $now = self::timestamp(self::TZ); $tmin = ( $now - ( self::TIMEFRAME/2 ) ); $tmax = ( $now + ( self::TIMEFRAME/2 ) ); if( ($tmin>$tmax ) or ( $tmin<$tmax ) ) return false; //out of time range $data = strval( $data ); $computed_sig = self::signature($data, $privateKey, $timestamp); return $signature == $computed_sig; } public static function sign($data, $privateKey, $timestamp=null){ $timestamp = empty($timestamp) ? self::timestamp(self::TZ) : intval($timestamp); $data = strval( $data ); $sig = base64_encode( hash_hmac("sha256", $data, $privateKey . '-' . date(self::TIME, $timestamp), true) ); echo "Time: " . $timestamp; return $sig; } public static function timestamp($tz='GTM'){ $tz = new \DateTimeZone($tz); return date_create(NULL, $tz)->getTimestamp(); } public static function isValid($algo){ $algos = hash_algos(); return in_array($algo, $algos); } } date_default_timezone_set('UTC'); $timestamp = empty($timestamp) ? CRYPTO::timestamp(CRYPTO::TZ) : intval($timestamp); $success_url = "https://www.google.si/search?q=succesds"; $url = urlencode($success_url); echo " URL: " . $url; echo " Signature: " . CRYPTO::sign( $url, 'sddddddddddddddsa', $timestamp);

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.0140.00717.00
8.3.50.0100.01121.09
8.3.40.0040.01118.98
8.3.30.0100.00319.09
8.3.20.0040.00420.38
8.3.10.0040.00421.78
8.3.00.0090.00019.51
8.2.180.0070.01016.75
8.2.170.0080.00622.96
8.2.160.0090.00620.44
8.2.150.0080.00025.66
8.2.140.0100.00724.66
8.2.130.0080.00026.16
8.2.120.0040.00420.99
8.2.110.0090.00022.19
8.2.100.0000.01118.03
8.2.90.0080.00019.08
8.2.80.0080.00017.97
8.2.70.0050.00317.75
8.2.60.0000.00818.04
8.2.50.0040.00418.07
8.2.40.0040.00420.06
8.2.30.0030.00518.00
8.2.20.0070.00317.89
8.2.10.0050.00318.14
8.2.00.0000.00718.11
8.1.280.0070.01125.92
8.1.270.0030.01420.33
8.1.260.0100.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00923.92
8.1.230.0090.00317.70
8.1.220.0090.00017.74
8.1.210.0000.00818.77
8.1.200.0090.00017.47
8.1.190.0060.00317.35
8.1.180.0060.00318.10
8.1.170.0030.00518.62
8.1.160.0000.00722.00
8.1.150.0070.00019.02
8.1.140.0040.00417.47
8.1.130.0040.00417.75
8.1.120.0050.00217.46
8.1.110.0040.00417.58
8.1.100.0000.00817.60
8.1.90.0000.00717.60
8.1.80.0000.00817.58
8.1.70.0000.00717.59
8.1.60.0090.00017.55
8.1.50.0090.00017.66
8.1.40.0000.00817.52
8.1.30.0000.00817.69
8.1.20.0000.01017.65
8.1.10.0030.00517.60
8.1.00.0040.00417.58
8.0.300.0030.00618.77
8.0.290.0040.00416.88
8.0.280.0000.00718.50
8.0.270.0040.00417.38
8.0.260.0030.00317.27
8.0.250.0070.00017.13
8.0.240.0030.00617.07
8.0.230.0000.00717.00
8.0.220.0030.00516.98
8.0.210.0020.00516.91
8.0.200.0000.00917.08
8.0.190.0040.00417.12
8.0.180.0050.00216.90
8.0.170.0000.00717.07
8.0.160.0000.00716.97
8.0.150.0040.00416.88
8.0.140.0040.00417.01
8.0.130.0000.00513.41
8.0.120.0000.00916.96
8.0.110.0000.00816.90
8.0.100.0040.00416.94
8.0.90.0070.00016.91
8.0.80.0100.00717.07
8.0.70.0000.00716.88
8.0.60.0000.00717.10
8.0.50.0030.00517.00
8.0.30.0150.00617.19
8.0.20.0090.01117.40
8.0.10.0050.00316.89
8.0.00.0090.00916.94
7.4.330.0060.00015.14
7.4.320.0000.00616.64
7.4.300.0000.00616.60
7.4.290.0030.00316.58
7.4.280.0060.00316.71
7.4.270.0030.00516.71
7.4.260.0030.00316.65
7.4.250.0050.00316.65
7.4.240.0030.00416.65
7.4.230.0000.00716.69
7.4.220.0110.00716.53
7.4.210.0060.00916.80
7.4.200.0040.00416.43
7.4.160.0160.00016.72
7.4.150.0060.01217.40
7.4.140.0110.00717.86
7.4.130.0090.00816.64
7.4.120.0050.01216.52
7.4.110.0130.00316.71
7.4.100.0070.01016.54
7.4.90.0060.00916.89
7.4.80.0060.01019.39
7.4.70.0130.00616.64
7.4.60.0070.01016.73
7.4.50.0000.00816.50
7.4.40.0110.00716.63
7.4.30.0160.00016.51
7.4.00.0070.00815.16
7.3.330.0030.00313.32
7.3.320.0000.00613.24
7.3.310.0030.00316.48
7.3.300.0060.00016.47
7.3.290.0070.00816.47
7.3.280.0070.00816.43
7.3.270.0160.00817.40
7.3.260.0110.00716.57
7.3.250.0080.00816.58
7.3.240.0120.00416.52
7.3.230.0140.00416.45
7.3.210.0080.00816.54
7.3.200.0110.00519.39
7.3.190.0140.00316.38
7.3.180.0100.01016.42
7.3.170.0080.01216.37
7.3.160.0120.00416.62
7.2.330.0040.01416.94
7.2.320.0120.00516.56
7.2.310.0090.00916.91
7.2.300.0100.00616.93
7.2.290.0100.01316.72
7.2.00.0030.01019.58
7.1.200.0000.01015.58
7.1.100.0000.01118.12
7.1.70.0060.00317.08
7.1.60.0070.01619.59
7.1.50.0240.00017.05
7.1.00.0070.07022.51
7.0.200.0130.00716.60
7.0.100.0070.08021.72
7.0.90.0130.08021.66
7.0.80.0130.07321.84
7.0.70.0100.04321.76
7.0.60.0030.08321.88
7.0.50.0130.07722.09
7.0.40.0030.09020.12
7.0.30.0070.09320.05
7.0.20.0070.08720.07
7.0.10.0070.07320.03
7.0.00.0030.07320.18
5.6.280.0030.07320.80
5.6.250.0170.07320.64
5.6.240.0070.08020.70
5.6.230.0100.08320.73
5.6.220.0030.04720.63
5.6.210.0030.08320.66
5.6.200.0130.07021.07
5.6.190.0000.07721.14
5.6.180.0070.04721.04
5.6.170.0000.07721.05
5.6.160.0030.05021.05
5.6.150.0000.08721.12
5.6.140.0130.07021.05
5.6.130.0070.10321.07
5.6.120.0030.04321.05
5.6.110.0070.07721.09
5.6.100.0130.04020.97
5.6.90.0130.06321.16
5.6.80.0100.05020.43
5.6.70.0070.04020.47
5.6.60.0170.05720.40
5.6.50.0030.04720.32
5.6.40.0130.05020.41
5.6.30.0130.07320.54
5.6.20.0030.08020.32
5.6.10.0070.07320.43
5.6.00.0070.08320.38
5.5.380.0030.05020.41
5.5.370.0230.06720.38
5.5.360.0030.05320.45
5.5.350.0030.05720.47
5.5.340.0070.07720.66
5.5.330.0030.08720.77
5.5.320.0070.07320.95
5.5.310.0030.04720.91
5.5.300.0000.04320.79
5.5.290.0070.04020.88
5.5.280.0070.04320.85
5.5.270.0170.07320.91
5.5.260.0030.08020.76
5.5.250.0100.08020.47
5.5.240.0070.08020.32
5.5.230.0130.04320.28
5.5.220.0070.05020.30
5.5.210.0030.08320.27
5.5.200.0100.07720.15
5.5.190.0070.04320.30
5.5.180.0170.07320.27
5.5.160.0100.07720.25
5.5.150.0130.06720.24
5.5.140.0030.05320.22
5.5.130.0070.06320.25
5.5.120.0030.07720.22
5.5.110.0070.07320.28
5.5.100.0070.06020.20
5.5.90.0170.03720.08
5.5.80.0070.06020.11
5.5.70.0070.05720.03
5.5.60.0070.07720.17
5.5.50.0030.08019.95
5.5.40.0070.07720.04
5.5.30.0130.07319.94
5.5.20.0100.07720.10
5.5.10.0070.04720.11
5.5.00.0030.07719.97
5.4.450.0030.08719.18
5.4.440.0030.05319.18
5.4.430.0070.06319.45
5.4.420.0070.07719.48
5.4.410.0100.07019.38
5.4.400.0100.04019.13
5.4.390.0070.08019.04
5.4.380.0100.07019.07
5.4.370.0130.05719.04
5.4.360.0130.07319.04
5.4.350.0070.07019.02
5.4.340.0030.06319.04
5.4.320.0030.07019.14
5.4.310.0030.08019.21
5.4.300.0070.07319.03
5.4.290.0000.08019.23
5.4.280.0100.07019.18
5.4.270.0070.07719.12
5.4.260.0000.05319.09
5.4.250.0070.08018.95
5.4.240.0170.06718.84
5.4.230.0030.05719.20
5.4.220.0000.08019.01
5.4.210.0000.06319.20
5.4.200.0070.04319.15
5.4.190.0030.08018.84
5.4.180.0100.06718.84
5.4.170.0030.08319.15
5.4.160.0030.07019.10
5.4.150.0100.07319.00
5.4.140.0170.03316.39
5.4.130.0000.08016.19
5.4.120.0100.06716.54
5.4.110.0030.05716.45
5.4.100.0070.05716.52
5.4.90.0070.06716.48
5.4.80.0100.05316.38
5.4.70.0100.06016.40
5.4.60.0100.07016.44
5.4.50.0030.07016.52
5.4.40.0000.07316.38
5.4.30.0000.08316.27
5.4.20.0070.04316.26
5.4.10.0030.08016.39
5.4.00.0170.06315.90

preferences:
53.71 ms | 401 KiB | 5 Q