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, 'sdfddfdddfddfddfddfddfddfddfddfddfddfddfddfddpodaopposa', $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.0060.00916.75
8.3.50.0140.00621.20
8.3.40.0100.01018.82
8.3.30.0060.01219.09
8.3.20.0090.00620.29
8.3.10.0080.00023.60
8.3.00.0060.00317.38
8.2.180.0100.01018.41
8.2.170.0110.00419.08
8.2.160.0140.00022.96
8.2.150.0040.00425.66
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0120.00321.13
8.2.110.0030.00919.32
8.2.100.0070.00717.75
8.2.90.0040.00419.08
8.2.80.0000.00817.97
8.2.70.0030.00617.63
8.2.60.0030.00517.80
8.2.50.0040.00418.07
8.2.40.0040.00420.01
8.2.30.0080.00018.03
8.2.20.0040.00417.77
8.2.10.0040.00418.02
8.2.00.0060.00318.15
8.1.280.0140.00725.92
8.1.270.0040.00420.45
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00622.71
8.1.230.0080.00317.64
8.1.220.0030.00517.74
8.1.210.0060.00318.77
8.1.200.0060.00317.48
8.1.190.0050.00317.48
8.1.180.0060.00318.10
8.1.170.0040.00418.61
8.1.160.0070.00022.00
8.1.150.0040.00418.83
8.1.140.0000.00817.70
8.1.130.0050.00317.73
8.1.120.0040.00417.67
8.1.110.0050.00317.62
8.1.100.0000.00717.64
8.1.90.0000.00717.62
8.1.80.0000.00817.56
8.1.70.0030.00317.60
8.1.60.0030.00617.73
8.1.50.0040.00417.55
8.1.40.0000.00917.48
8.1.30.0000.00817.63
8.1.20.0040.00417.70
8.1.10.0040.00417.67
8.1.00.0030.00617.64
8.0.300.0040.00418.77
8.0.290.0020.00516.75
8.0.280.0040.00418.48
8.0.270.0040.00417.15
8.0.260.0030.00317.23
8.0.250.0030.00317.05
8.0.240.0070.00317.17
8.0.230.0000.01117.16
8.0.220.0070.00016.94
8.0.210.0000.00716.95
8.0.200.0030.00317.00
8.0.190.0000.00716.99
8.0.180.0080.00017.03
8.0.170.0040.00417.10
8.0.160.0000.00816.93
8.0.150.0000.00717.05
8.0.140.0070.00016.91
8.0.130.0030.00313.45
8.0.120.0030.00516.84
8.0.110.0050.00217.11
8.0.100.0040.00416.85
8.0.90.0070.00016.85
8.0.80.0120.00617.00
8.0.70.0000.00916.83
8.0.60.0040.00417.09
8.0.50.0000.00717.04
8.0.30.0130.00517.22
8.0.20.0130.00917.46
8.0.10.0080.00017.01
8.0.00.0100.00816.93
7.4.330.0000.00615.04
7.4.320.0000.00616.61
7.4.300.0060.00016.61
7.4.290.0000.00716.68
7.4.280.0030.00516.50
7.4.270.0060.00016.54
7.4.260.0050.00216.71
7.4.250.0000.00816.46
7.4.240.0050.00316.64
7.4.230.0040.00416.62
7.4.220.0120.01316.67
7.4.210.0110.00416.66
7.4.200.0000.00716.39
7.4.160.0090.00616.49
7.4.150.0070.01117.40
7.4.140.0090.01117.86
7.4.130.0090.01316.61
7.4.120.0090.00716.60
7.4.110.0160.00916.59
7.4.100.0130.01016.52
7.4.90.0140.00716.61
7.4.80.0090.00919.39
7.4.70.0030.01616.58
7.4.60.0100.01016.68
7.4.50.0050.00316.63
7.4.40.0130.00316.46
7.4.30.0160.00916.53
7.4.00.0030.00915.27
7.3.330.0030.00313.29
7.3.320.0050.00013.27
7.3.310.0030.00516.48
7.3.300.0030.00316.50
7.3.290.0040.00416.47
7.3.280.0090.00816.50
7.3.270.0090.00917.40
7.3.260.0130.00316.60
7.3.250.0130.00716.48
7.3.240.0060.01216.57
7.3.230.0060.01216.74
7.3.210.0030.01716.45
7.3.200.0060.01219.39
7.3.190.0090.00616.60
7.3.180.0090.01216.67
7.3.170.0110.00516.42
7.3.160.0060.01616.69
7.2.330.0030.02016.90
7.2.320.0090.01216.91
7.2.310.0080.00816.57
7.2.300.0100.00716.79
7.2.290.0150.00916.71
7.2.00.0000.01119.16
7.1.100.0040.01118.22
7.1.70.0030.00617.29
7.1.60.0000.01117.37
7.1.50.0200.00317.01
7.1.00.0030.07722.36
7.0.200.0070.01016.92
7.0.100.0070.07721.80
7.0.90.0130.06321.77
7.0.80.0100.07021.68
7.0.70.0070.08321.73
7.0.60.0070.08021.78
7.0.50.0070.08022.03
7.0.40.0070.07320.17
7.0.30.0070.07320.09
7.0.20.0000.08320.07
7.0.10.0100.07020.07
7.0.00.0030.08019.99
5.6.280.0030.07021.14
5.6.250.0000.05720.71
5.6.240.0070.04720.77
5.6.230.0000.07720.64
5.6.220.0100.07720.50
5.6.210.0030.08720.68
5.6.200.0070.08021.07
5.6.190.0030.05720.98
5.6.180.0070.08021.18
5.6.170.0030.05721.09
5.6.160.0070.05720.96
5.6.150.0070.07321.06
5.6.140.0070.08020.98
5.6.130.0070.05721.08
5.6.120.0070.05021.12
5.6.110.0030.08021.01
5.6.100.0030.06021.13
5.6.90.0030.08021.10
5.6.80.0070.07720.51
5.6.70.0170.03320.34
5.6.60.0030.08020.43
5.6.50.0100.07720.42
5.6.40.0070.07720.33
5.6.30.0070.07320.40
5.6.20.0030.05320.48
5.6.10.0030.06720.45
5.6.00.0130.06720.49
5.5.380.0030.07720.36
5.5.370.0030.04720.39
5.5.360.0070.04320.38
5.5.350.0130.05320.38
5.5.340.0000.08720.85
5.5.330.0030.08320.82
5.5.320.0000.07320.66
5.5.310.0000.05020.85
5.5.300.0100.07720.93
5.5.290.0070.07320.84
5.5.280.0070.06020.61
5.5.270.0030.08320.87
5.5.260.0030.08720.73
5.5.250.0030.08320.69
5.5.240.0000.05020.29
5.5.230.0000.04020.30
5.5.220.0000.08020.28
5.5.210.0000.07720.27
5.5.200.0030.08020.18
5.5.190.0000.06020.13
5.5.180.0030.07720.16
5.5.160.0070.07320.25
5.5.150.0130.04020.16
5.5.140.0030.07320.25
5.5.130.0070.05720.00
5.5.120.0030.08020.13
5.5.110.0000.08020.25
5.5.100.0030.06720.13
5.5.90.0030.05320.13
5.5.80.0030.07320.15
5.5.70.0130.06719.98
5.5.60.0130.06020.05
5.5.50.0000.08320.07
5.5.40.0070.07720.01
5.5.30.0000.04719.94
5.5.20.0070.05719.97
5.5.10.0100.06320.15
5.5.00.0030.08020.09
5.4.450.0030.08019.46
5.4.440.0100.04319.23
5.4.430.0100.04319.54
5.4.420.0030.04719.45
5.4.410.0030.08319.22
5.4.400.0030.07318.92
5.4.390.0000.04018.88
5.4.380.0130.05719.05
5.4.370.0030.07019.13
5.4.360.0000.08719.28
5.4.350.0030.07319.12
5.4.340.0030.06718.88
5.4.320.0030.07719.18
5.4.310.0070.06719.03
5.4.300.0070.07318.89
5.4.290.0030.07318.85
5.4.280.0000.07719.04
5.4.270.0070.07019.02
5.4.260.0030.07318.88
5.4.250.0000.06318.89
5.4.240.0070.07319.13
5.4.230.0100.07019.09
5.4.220.0070.04319.11
5.4.210.0100.04018.99
5.4.200.0030.04319.04
5.4.190.0000.08319.11
5.4.180.0100.06319.07
5.4.170.0030.06319.11
5.4.160.0030.04319.14
5.4.150.0070.07319.13
5.4.140.0000.05016.52
5.4.130.0070.03016.41
5.4.120.0030.07316.55
5.4.110.0100.03716.56
5.4.100.0000.07716.38
5.4.90.0070.07016.54
5.4.80.0070.07316.52
5.4.70.0030.07016.36
5.4.60.0030.05716.25
5.4.50.0070.06716.40
5.4.40.0000.06316.46
5.4.30.0000.07716.39
5.4.20.0030.04316.35
5.4.10.0030.07316.29
5.4.00.0000.07015.90

preferences:
69.5 ms | 401 KiB | 5 Q