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, 'sagggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggdgggggggggggggggggdggggfddfddfddfdfdHaasokdpodaopposa', $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.70.0160.00317.00
8.3.60.0070.01416.88
8.3.50.0140.00521.22
8.3.40.0100.01018.92
8.3.30.0060.01118.97
8.3.20.0000.00720.25
8.3.10.0040.00423.53
8.3.00.0040.00417.50
8.2.190.0000.01416.96
8.2.180.0070.00716.75
8.2.170.0120.00422.96
8.2.160.0070.01020.48
8.2.150.0050.00325.66
8.2.140.0030.01724.66
8.2.130.0000.00826.16
8.2.120.0000.00720.94
8.2.110.0070.00319.27
8.2.100.0090.00317.75
8.2.90.0060.00319.08
8.2.80.0060.00317.97
8.2.70.0030.00617.63
8.2.60.0030.00617.79
8.2.50.0000.00818.07
8.2.40.0040.00418.16
8.2.30.0040.00418.14
8.2.20.0000.00817.93
8.2.10.0000.00818.22
8.2.00.0000.00818.25
8.1.280.0100.01025.92
8.1.270.0120.00420.42
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0060.00322.67
8.1.230.0050.00517.77
8.1.220.0030.00617.74
8.1.210.0040.00418.77
8.1.200.0000.01017.48
8.1.190.0030.00517.35
8.1.180.0030.00518.10
8.1.170.0040.00418.41
8.1.160.0040.00422.11
8.1.150.0050.00218.78
8.1.140.0000.00717.69
8.1.130.0080.00017.80
8.1.120.0040.00417.66
8.1.110.0050.00217.52
8.1.100.0070.00017.54
8.1.90.0030.00517.61
8.1.80.0040.00417.65
8.1.70.0040.00417.60
8.1.60.0000.00917.55
8.1.50.0040.00717.67
8.1.40.0030.00517.56
8.1.30.0080.00017.75
8.1.20.0040.00417.80
8.1.10.0040.00417.66
8.1.00.0050.00317.47
8.0.300.0070.00018.77
8.0.290.0050.00316.88
8.0.280.0030.00318.50
8.0.270.0000.00717.30
8.0.260.0030.00317.25
8.0.250.0030.00317.09
8.0.240.0070.00317.04
8.0.230.0040.00417.13
8.0.220.0080.00017.02
8.0.210.0000.00717.13
8.0.200.0000.00817.13
8.0.190.0000.00817.17
8.0.180.0040.00417.06
8.0.170.0050.00217.00
8.0.160.0000.00716.99
8.0.150.0000.00716.89
8.0.140.0000.00817.03
8.0.130.0060.00013.58
8.0.120.0080.00017.11
8.0.110.0000.00716.93
8.0.100.0000.00716.88
8.0.90.0000.00717.05
8.0.80.0000.01517.09
8.0.70.0050.00217.04
8.0.60.0040.00417.04
8.0.50.0000.00716.96
8.0.30.0140.00317.20
8.0.20.0190.00717.43
8.0.10.0040.00417.09
8.0.00.0080.01116.92
7.4.330.0060.00015.07
7.4.320.0030.00316.72
7.4.300.0030.00316.73
7.4.290.0040.00416.47
7.4.280.0000.00716.51
7.4.270.0030.00316.77
7.4.260.0000.00513.48
7.4.250.0000.00716.68
7.4.240.0020.00516.67
7.4.230.0070.00016.75
7.4.220.0130.01016.65
7.4.210.0040.01116.64
7.4.200.0000.00716.70
7.4.160.0030.01316.57
7.4.150.0100.01317.40
7.4.140.0170.00717.86
7.4.130.0130.00816.54
7.4.120.0170.00516.65
7.4.110.0000.01916.89
7.4.100.0150.00716.44
7.4.90.0160.00716.52
7.4.80.0070.01019.39
7.4.70.0060.01216.59
7.4.60.0080.00816.48
7.4.50.0090.00016.45
7.4.40.0100.01016.75
7.4.30.0170.00316.75
7.4.00.0040.00814.85
7.3.330.0030.00313.32
7.3.320.0060.00013.30
7.3.310.0000.00716.32
7.3.300.0040.00416.37
7.3.290.0070.01116.50
7.3.280.0100.01016.41
7.3.270.0080.01417.40
7.3.260.0060.01116.51
7.3.250.0110.00716.54
7.3.240.0130.00316.70
7.3.230.0120.00616.60
7.3.210.0000.01616.59
7.3.200.0160.00819.39
7.3.190.0120.00616.74
7.3.180.0050.01116.50
7.3.170.0120.01016.45
7.3.160.0100.00716.46
7.2.330.0150.00916.83
7.2.320.0180.00016.83
7.2.310.0030.01416.93
7.2.300.0130.00916.68
7.2.290.0090.00916.68
7.2.60.0120.00916.80
7.2.50.0090.00617.08
7.2.00.0040.00819.23
7.1.200.0080.00615.80
7.1.100.0060.00918.07
7.1.70.0130.00317.01
7.1.60.0040.01219.59
7.1.50.0100.01317.01
7.1.00.0030.07722.48
7.0.200.0000.00816.91
7.0.100.0070.04020.19
7.0.90.0070.05719.92
7.0.80.0030.05320.04
7.0.70.0070.08019.89
7.0.60.0070.07019.97
7.0.50.0530.07720.30
7.0.40.0030.08720.08
7.0.30.0200.07020.04
7.0.20.0170.08020.13
7.0.10.0170.07320.13
7.0.00.0100.06019.99
5.6.280.0030.07021.16
5.6.250.0030.04320.64
5.6.240.0100.03720.77
5.6.230.0000.04320.70
5.6.220.0100.05720.62
5.6.210.0070.05720.76
5.6.200.0070.04721.06
5.6.190.0130.07720.98
5.6.180.0200.07321.09
5.6.170.0070.06320.90
5.6.160.0070.08321.11
5.6.150.0070.06321.14
5.6.140.0030.08721.05
5.6.130.0030.08321.08
5.6.120.0070.08020.95
5.6.110.0070.06721.14
5.6.100.0070.09321.02
5.6.90.0100.08020.93
5.6.80.0000.05020.56
5.6.70.0130.05320.48
5.6.60.0070.08020.34
5.6.50.0070.08020.41
5.6.40.0000.05020.44
5.6.30.0070.04720.38
5.6.20.0070.08320.42
5.6.10.0070.08720.42
5.6.00.0070.05720.41
5.5.380.0030.04020.42
5.5.370.0030.04020.51
5.5.360.0070.05720.36
5.5.350.0100.04720.42
5.5.340.0100.08020.79
5.5.330.0130.07320.66
5.5.320.0100.08020.84
5.5.310.0070.04320.85
5.5.300.0100.08320.74
5.5.290.0030.05320.92
5.5.280.0030.09020.89
5.5.270.0030.08720.92
5.5.260.0070.06320.92
5.5.250.0030.07720.68
5.5.240.0030.04320.29
5.5.230.0070.08720.04
5.5.220.0200.06720.15
5.5.210.0070.05320.32
5.5.200.0100.07720.11
5.5.190.0130.07320.23
5.5.180.0100.05020.29
5.5.160.0100.08020.20
5.5.150.0130.05720.24
5.5.140.0070.06720.24
5.5.130.0070.08720.30
5.5.120.0030.04720.13
5.5.110.0130.07020.27
5.5.100.0030.07720.07
5.5.90.0070.08020.11
5.5.80.0100.06020.11
5.5.70.0130.06320.01
5.5.60.0070.04720.16
5.5.50.0030.04320.18
5.5.40.0100.06320.07
5.5.30.0030.07720.01
5.5.20.0100.05020.15
5.5.10.0070.05320.02
5.5.00.0200.04020.03
5.4.450.0100.07719.23
5.4.440.0070.08319.20
5.4.430.0030.04319.37
5.4.420.0030.08719.41
5.4.410.0200.06719.33
5.4.400.0070.08319.05
5.4.390.0030.06019.13
5.4.380.0070.04019.03
5.4.370.0130.07319.16
5.4.360.0100.04719.16
5.4.350.0170.06319.06
5.4.340.0030.07318.95
5.4.320.0130.04019.03
5.4.310.0200.03719.04
5.4.300.0070.07719.17
5.4.290.0030.07018.87
5.4.280.0130.07019.04
5.4.270.0100.07019.16
5.4.260.0070.03719.16
5.4.250.0100.05019.17
5.4.240.0100.07018.84
5.4.230.0070.04319.20
5.4.220.0130.06319.22
5.4.210.0130.06718.94
5.4.200.0000.08019.02
5.4.190.0030.05019.17
5.4.180.0030.05318.94
5.4.170.0100.05019.04
5.4.160.0130.07319.21
5.4.150.0130.05019.20
5.4.140.0030.08016.39
5.4.130.0070.07716.24
5.4.120.0070.06716.25
5.4.110.0170.06016.48
5.4.100.0100.04716.54
5.4.90.0000.07016.39
5.4.80.0070.07316.39
5.4.70.0070.07016.39
5.4.60.0130.06316.30
5.4.50.0100.06716.48
5.4.40.0100.05016.53
5.4.30.0100.07016.45
5.4.20.0070.04316.48
5.4.10.0130.06316.30
5.4.00.0030.07315.88

preferences:
60.49 ms | 401 KiB | 5 Q