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=sucasasascesds"; $url = urlencode($success_url); echo " URL: " . $url; echo " Signature: " . CRYPTO::sign( $url, 'sdsadass42323daddpodaoppsdaosa', $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.0090.01216.63
8.3.50.0110.01121.18
8.3.40.0070.00718.81
8.3.30.0120.00318.95
8.3.20.0050.00320.34
8.3.10.0000.00821.74
8.3.00.0030.00619.40
8.2.180.0060.01216.75
8.2.170.0110.00422.96
8.2.160.0070.00720.35
8.2.150.0030.00625.66
8.2.140.0070.01124.66
8.2.130.0080.00026.16
8.2.120.0120.00321.00
8.2.110.0060.00319.10
8.2.100.0080.00417.84
8.2.90.0030.00619.13
8.2.80.0030.00517.97
8.2.70.0100.00017.75
8.2.60.0030.00517.79
8.2.50.0050.00318.10
8.2.40.0040.00420.07
8.2.30.0040.00418.09
8.2.20.0000.00817.83
8.2.10.0050.00318.13
8.2.00.0040.00418.14
8.1.280.0030.01725.92
8.1.270.0140.00720.33
8.1.260.0050.00226.35
8.1.250.0080.00028.09
8.1.240.0000.00922.73
8.1.230.0110.00017.70
8.1.220.0030.00517.77
8.1.210.0000.00818.77
8.1.200.0030.00617.23
8.1.190.0040.00417.36
8.1.180.0000.00818.10
8.1.170.0040.00418.65
8.1.160.0000.00722.03
8.1.150.0040.00418.97
8.1.140.0050.00217.55
8.1.130.0070.00017.67
8.1.120.0070.00017.68
8.1.110.0050.00317.57
8.1.100.0030.00517.59
8.1.90.0000.00717.60
8.1.80.0040.00417.61
8.1.70.0030.00317.52
8.1.60.0060.00317.61
8.1.50.0030.00617.64
8.1.40.0040.00417.55
8.1.30.0040.00417.61
8.1.20.0000.00817.73
8.1.10.0050.00317.71
8.1.00.0000.00817.57
8.0.300.0060.00318.77
8.0.290.0000.00816.88
8.0.280.0000.00718.42
8.0.270.0030.00317.28
8.0.260.0030.00617.27
8.0.250.0030.00317.13
8.0.240.0040.00416.98
8.0.230.0040.00317.13
8.0.220.0030.00317.02
8.0.210.0000.00716.91
8.0.200.0030.00317.07
8.0.190.0030.00517.08
8.0.180.0000.00817.12
8.0.170.0050.00317.08
8.0.160.0000.00816.91
8.0.150.0040.00417.09
8.0.140.0060.00317.04
8.0.130.0000.00513.51
8.0.120.0040.00416.99
8.0.110.0000.00717.02
8.0.100.0040.00416.87
8.0.90.0070.00016.93
8.0.80.0030.01317.08
8.0.70.0040.00416.99
8.0.60.0040.00417.00
8.0.50.0000.00716.93
8.0.30.0070.00917.22
8.0.20.0110.00817.40
8.0.10.0040.00416.90
8.0.00.0120.00616.91
7.4.330.0000.00615.04
7.4.320.0000.00616.73
7.4.300.0060.00016.58
7.4.290.0030.00316.64
7.4.280.0070.00316.63
7.4.270.0030.00316.59
7.4.260.0030.00316.62
7.4.250.0040.00416.61
7.4.240.0040.00316.67
7.4.230.0070.00016.77
7.4.220.0060.01216.63
7.4.210.0080.00616.71
7.4.200.0040.00416.75
7.4.160.0090.00616.52
7.4.150.0110.00717.40
7.4.140.0130.01117.86
7.4.130.0120.01016.73
7.4.120.0070.01416.59
7.4.110.0060.01216.54
7.4.100.0160.00716.70
7.4.90.0110.00716.69
7.4.80.0030.02019.39
7.4.70.0130.00316.60
7.4.60.0090.01216.67
7.4.50.0000.00516.64
7.4.40.0120.00916.55
7.4.30.0080.00916.67
7.4.10.0110.00715.16
7.4.00.0040.01115.00
7.3.330.0050.00013.37
7.3.320.0000.00613.43
7.3.310.0040.00416.32
7.3.300.0050.00216.47
7.3.290.0150.00616.42
7.3.280.0060.01116.43
7.3.270.0140.00317.40
7.3.260.0090.00916.57
7.3.250.0080.00816.51
7.3.240.0000.01716.67
7.3.230.0170.00416.70
7.3.210.0040.01216.58
7.3.200.0140.00719.39
7.3.190.0200.00016.63
7.3.180.0030.01316.31
7.3.170.0230.00016.61
7.3.160.0070.01116.46
7.3.130.0030.01215.14
7.3.120.0130.00414.86
7.3.110.0080.01014.91
7.3.100.0090.00615.12
7.3.90.0090.00414.79
7.3.80.0080.00615.02
7.3.70.0040.01214.98
7.3.60.0040.01014.77
7.3.50.0080.00614.88
7.3.40.0030.01014.77
7.3.30.0060.01114.85
7.3.20.0060.01016.68
7.3.10.0040.00916.74
7.3.00.0080.00616.76
7.2.330.0180.00016.82
7.2.320.0060.01116.93
7.2.310.0060.01016.84
7.2.300.0070.01016.57
7.2.290.0200.00316.94
7.2.260.0100.01015.02
7.2.250.0050.01015.08
7.2.240.0070.01015.11
7.2.230.0100.00515.27
7.2.220.0050.01115.12
7.2.210.0060.00715.24
7.2.200.0050.00815.24
7.2.190.0050.00915.19
7.2.180.0040.00715.18
7.2.170.0070.00615.18
7.2.160.0080.00515.09
7.2.150.0060.00817.10
7.2.140.0050.01117.13
7.2.130.0060.00816.92
7.2.120.0020.01317.01
7.2.110.0020.01216.92
7.2.100.0050.00917.04
7.2.90.0060.00717.08
7.2.80.0060.00917.01
7.2.70.0080.00716.97
7.2.60.0090.00616.92
7.2.50.0020.00917.07
7.2.40.0050.00517.06
7.2.30.0060.00817.05
7.2.20.0030.00916.89
7.2.10.0020.01217.06
7.2.00.0070.00817.67
7.1.330.0040.01015.89
7.1.320.0040.01015.84
7.1.310.0080.00415.74
7.1.300.0060.00715.83
7.1.290.0050.00815.72
7.1.280.0080.00315.79
7.1.270.0090.00415.81
7.1.260.0030.00915.62
7.1.250.0020.01115.78
7.1.240.0060.00615.60
7.1.230.0030.01015.77
7.1.220.0100.00715.82
7.1.210.0060.00315.96
7.1.200.0050.00715.82
7.1.190.0090.00615.96
7.1.180.0060.00315.82
7.1.170.0000.01015.67
7.1.160.0050.00315.58
7.1.150.0040.00915.64
7.1.140.0000.01415.71
7.1.130.0070.00715.79
7.1.120.0040.00715.61
7.1.110.0090.00915.71
7.1.100.0050.01117.03
7.1.90.0000.00816.09
7.1.80.0000.01215.60
7.1.70.0040.00816.35
7.1.60.0080.01117.76
7.1.50.0120.00616.51
7.1.40.0070.00315.96
7.1.30.0070.00715.95
7.1.20.0000.01015.79
7.1.10.0000.01415.50
7.1.00.0040.04319.21
7.0.330.0030.00815.42
7.0.320.0070.00415.70
7.0.310.0040.00715.52
7.0.300.0000.01215.53
7.0.290.0050.00615.50
7.0.280.0100.00315.48
7.0.270.0060.00615.68
7.0.260.0040.01115.64
7.0.250.0030.01315.45
7.0.240.0040.01415.46
7.0.230.0040.00815.39
7.0.220.0060.00615.70
7.0.210.0060.00315.45
7.0.200.0070.00616.04
7.0.190.0130.00315.57
7.0.180.0000.00815.59
7.0.170.0030.00615.42
7.0.160.0080.00615.51
7.0.150.0080.00815.58
7.0.140.0000.01215.57
7.0.130.0060.00615.25
7.0.120.0000.00815.32
7.0.110.0130.00315.34
7.0.100.0080.02017.68
7.0.90.0050.02817.67
7.0.80.0030.02717.72
7.0.70.0040.02217.75
7.0.60.0020.03317.81
7.0.50.0030.03017.87
7.0.40.0050.03116.84
7.0.30.0030.03016.77
7.0.20.0080.02616.84
7.0.10.0050.02016.79
7.0.00.0050.02516.66
5.6.400.0040.00414.43
5.6.390.0000.00914.77
5.6.380.0100.00314.74
5.6.370.0110.00413.99
5.6.360.0030.01214.40
5.6.350.0030.01014.41
5.6.340.0040.01214.14
5.6.330.0000.01014.57
5.6.320.0090.00614.41
5.6.310.0060.00614.52
5.6.300.0130.00314.34
5.6.290.0080.00314.27
5.6.280.0080.03817.66
5.6.270.0070.00714.75
5.6.260.0110.00414.38
5.6.250.0030.02517.43
5.6.240.0050.02917.50
5.6.230.0050.02317.47
5.6.220.0090.02017.51
5.6.210.0060.02217.59
5.6.200.0020.03217.78
5.6.190.0070.02717.76
5.6.180.0070.02817.69
5.6.170.0020.03417.60
5.6.160.0040.03117.78
5.6.150.0030.02617.63
5.6.140.0080.02317.72
5.6.130.0030.02717.89
5.6.120.0060.03517.81
5.6.110.0050.02917.85
5.6.100.0030.03217.65
5.6.90.0070.04417.63
5.6.80.0030.02717.21
5.6.70.0070.04417.41
5.6.60.0080.04017.33
5.6.50.0100.04017.30
5.6.40.0130.01817.33
5.6.30.0150.03517.32
5.6.20.0080.04017.35
5.6.10.0120.04217.26
5.6.00.0070.04017.56
5.5.380.0080.02317.36
5.5.370.0030.02817.38
5.5.360.0020.03017.43
5.5.350.0050.02317.41
5.5.340.0020.02317.54
5.5.330.0070.02417.66
5.5.320.0070.02517.61
5.5.310.0020.03017.58
5.5.300.0060.02117.67
5.5.290.0050.02517.63
5.5.280.0020.03617.44
5.5.270.0030.03817.60
5.5.260.0080.04417.54
5.5.250.0090.03917.54
5.5.240.0020.04717.13
5.5.230.0080.02517.37
5.5.220.0050.04717.30
5.5.210.0120.03817.14
5.5.200.0070.04617.32
5.5.190.0100.04017.10
5.5.180.0040.04117.09
5.5.170.0090.00614.46
5.5.160.0050.04217.24
5.5.150.0150.02317.12
5.5.140.0130.02717.02
5.5.130.0100.03817.23
5.5.120.0080.03817.18
5.5.110.0100.04017.15
5.5.100.0070.04317.11
5.5.90.0060.04017.16
5.5.80.0070.03317.18
5.5.70.0020.04617.27
5.5.60.0090.04017.22
5.5.50.0070.04217.24
5.5.40.0090.03417.14
5.5.30.0100.03817.22
5.5.20.0050.03017.15
5.5.10.0050.02717.13
5.5.00.0050.03616.93
5.4.450.0050.02716.12
5.4.440.0050.03016.08
5.4.430.0090.04416.03
5.4.420.0070.04515.99
5.4.410.0040.03416.00
5.4.400.0080.03015.88
5.4.390.0030.04215.78
5.4.380.0080.03115.90
5.4.370.0050.04015.87
5.4.360.0050.03315.87
5.4.350.0030.04715.92
5.4.340.0030.04815.92
5.4.330.0000.00612.71
5.4.320.0030.02915.78
5.4.310.0080.03315.92
5.4.300.0030.04515.97
5.4.290.0080.03815.93
5.4.280.0030.03815.88
5.4.270.0060.04115.83
5.4.260.0050.03515.96
5.4.250.0080.03815.78
5.4.240.0030.04415.83
5.4.230.0070.03815.94
5.4.220.0070.03515.91
5.4.210.0050.03015.96
5.4.200.0080.03915.90
5.4.190.0040.02915.77
5.4.180.0090.03315.94
5.4.170.0080.04215.87
5.4.160.0050.04015.79
5.4.150.0070.04215.91
5.4.140.0020.02514.58
5.4.130.0030.02114.56
5.4.120.0120.03714.50
5.4.110.0050.03814.55
5.4.100.0040.04614.52
5.4.90.0070.02514.55
5.4.80.0030.04014.51
5.4.70.0080.02314.56
5.4.60.0050.03814.58
5.4.50.0070.03214.53
5.4.40.0050.03114.59
5.4.30.0060.03814.59
5.4.20.0030.03214.60
5.4.10.0090.03514.57
5.4.00.0040.03314.27

preferences:
67.21 ms | 401 KiB | 5 Q