3v4l.org

run code in 300+ PHP versions simultaneously
<?php class CryptToken { private static $instance; private $crypt; private $token; private $context; public function __construct() { $this->InitCrypt(); } private function InitCrypt() { $this->crypt = (object)array(); $this->crypt->key = hash('sha512', 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'); } public static function GetInstance() { if(!isset(self::$instance)) { self::$instance = new self(); } return self::$instance; } public function Decrypt($buffer) { return mcrypt_decrypt(MCRYPT_RIJNDAEL_256, pack('H*', substr($this->crypt->key, 0, 64)), base64_decode($buffer), MCRYPT_MODE_OFB, pack('H*', substr($this->crypt->key, -64))); } public function Crypt($buffer) { return base64_encode( mcrypt_encrypt(MCRYPT_RIJNDAEL_256, pack('H*', substr($this->crypt->key, 0, 64)), $buffer, MCRYPT_MODE_OFB, pack('H*', substr($this->crypt->key, -64)))); } public function ParseToken($token) { $this->token = explode('|', $token); $this->ExtractValue(); return $this; } private function ExtractValue() { foreach($this->token as $item) { $current = explode('=', $item); if(count($current) == 2) { $this->context->{$current[0]} = $current[1]; } } } public function TimeStampCheck() { if($this->context->ts >= time()) { return true; } return false; } public function AdminCheck() { if($this->context->user == 'admin') { return true; } return false; } } echo time(); echo "\n"; echo CryptToken::GetInstance()->Crypt('user=admin|ts=' . (time() + 1000));

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)
7.3.10.0080.00616.61
7.3.00.0060.00316.52
7.2.130.0070.00716.78
7.2.120.0040.00716.99
7.2.110.0120.00016.99
7.2.100.0060.00616.94
7.2.90.0090.00317.15
7.2.80.0040.01116.68
7.2.70.0030.00917.02
7.2.60.0060.00917.11
7.2.50.0080.00317.05
7.2.40.0080.00617.16
7.2.30.0000.01317.13
7.2.20.0040.01116.77
7.2.10.0000.01516.95
7.2.00.0030.00918.17
7.1.250.0080.00415.77
7.1.200.0080.00515.87
7.1.100.0120.00018.06
7.1.70.0000.01117.14
7.1.60.0070.01719.70
7.1.50.0200.01116.63
7.1.00.0000.08022.40
7.0.200.0290.00316.63
7.0.140.0070.06722.11
7.0.80.0600.07019.92
7.0.70.0630.08319.95
7.0.60.0600.07319.92
7.0.50.0530.08320.33
7.0.40.0030.08320.23
7.0.30.0100.08320.14
7.0.20.0100.08720.22
7.0.10.0070.08020.16
7.0.00.0130.08020.23
5.6.280.0070.07021.07
5.6.230.0070.08720.68
5.6.220.0070.08020.65
5.6.210.0070.08720.58
5.6.200.0070.07021.15
5.6.190.0130.07721.21
5.6.180.0070.08021.13
5.6.170.0130.08321.09
5.6.160.0030.08721.05
5.6.150.0000.07721.15
5.6.140.0100.06721.13
5.6.130.0100.08721.14
5.6.120.0170.08021.11
5.6.110.0070.07720.97
5.6.100.0030.06021.13
5.6.90.0070.06021.23
5.6.80.0100.04320.54
5.6.70.0000.05320.55
5.6.60.0170.07720.43
5.6.50.0130.04020.59
5.6.40.0100.08020.48
5.6.30.0070.08320.52
5.6.20.0130.07720.48
5.6.10.0000.05720.53
5.6.00.0070.08020.45
5.5.370.0070.04720.56
5.5.360.0170.07020.36
5.5.350.0100.04720.38
5.5.340.0070.05020.75
5.5.330.0100.08320.82
5.5.320.0070.05020.87
5.5.310.0030.08720.92
5.5.300.0030.06020.97
5.5.290.0070.08721.00
5.5.280.0100.08020.97
5.5.270.0200.07020.85
5.5.260.0170.07720.96
5.5.250.0070.07720.64
5.5.240.0100.07720.25
5.5.230.0170.05020.38
5.5.220.0030.05720.37
5.5.210.0100.07720.38
5.5.200.0000.09320.36
5.5.190.0130.08020.35
5.5.180.0230.06320.27
5.5.160.0070.07720.34
5.5.150.0070.07720.25
5.5.140.0030.06020.36
5.5.130.0030.08320.28
5.5.120.0070.08020.36
5.5.110.0070.05720.31
5.5.100.0100.07020.20
5.5.90.0070.04320.15
5.5.80.0170.07020.16
5.5.70.0030.05720.24
5.5.60.0130.07320.23
5.5.50.0130.07020.07
5.5.40.0130.07020.23
5.5.30.0170.07320.16
5.5.20.0070.06320.03
5.5.10.0030.05020.10
5.5.00.0130.07320.09
5.4.450.0100.07319.39
5.4.440.0130.07719.60
5.4.430.0100.05319.56
5.4.420.0030.08019.40
5.4.410.0000.08319.19
5.4.400.0030.08319.19
5.4.390.0100.07319.13
5.4.380.0070.08319.11
5.4.370.0130.07019.10
5.4.360.0000.08719.08
5.4.350.0170.05319.28
5.4.340.0130.07019.18
5.4.320.0000.08319.09
5.4.310.0030.04318.94
5.4.300.0070.06019.07
5.4.290.0130.07019.17
5.4.280.0170.05019.07
5.4.270.0070.06719.19
5.4.260.0100.07319.28
5.4.250.0030.06019.10
5.4.240.0030.08719.09
5.4.230.0070.07318.91
5.4.220.0130.07319.23
5.4.210.0130.06719.09
5.4.200.0030.07319.10
5.4.190.0130.06719.18
5.4.180.0070.07018.98
5.4.170.0100.07318.95
5.4.160.0130.06718.94
5.4.150.0030.07019.16
5.4.140.0070.03716.51
5.4.130.0070.03716.52
5.4.120.0070.04016.50
5.4.110.0030.03716.46
5.4.100.0070.07016.47
5.4.90.0070.07016.48
5.4.80.0070.03716.54
5.4.70.0030.07716.55
5.4.60.0130.06316.46
5.4.50.0070.05016.51
5.4.40.0100.07016.37
5.4.30.0070.07716.43
5.4.20.0030.08016.46
5.4.10.0100.07316.43
5.4.00.0130.07015.95
5.3.290.0000.07014.68
5.3.280.0130.07314.59
5.3.270.0030.08014.59
5.3.260.0030.04714.64
5.3.250.0070.07014.77
5.3.240.0000.04314.75
5.3.230.0070.07014.61
5.3.220.0070.07314.56
5.3.210.0030.04014.57
5.3.200.0000.07014.57
5.3.190.0130.04014.61
5.3.180.0070.03314.61
5.3.170.0000.04314.65
5.3.160.0030.05714.59
5.3.150.0100.07014.64
5.3.140.0030.07714.57
5.3.130.0130.07314.63
5.3.120.0070.07714.59
5.3.110.0030.08014.50
5.3.100.0070.08014.04
5.3.90.0100.06713.99
5.3.80.0170.05013.97
5.3.70.0100.06714.15
5.3.60.0030.07314.02
5.3.50.0070.07713.90
5.3.40.0100.07314.03
5.3.30.0030.05013.86
5.3.20.0100.05713.82
5.3.10.0100.07013.63
5.3.00.0030.07713.68
5.2.170.0030.07011.20
5.2.160.0070.06011.24
5.2.150.0000.06711.04
5.2.140.0070.06311.18
5.2.130.0100.05711.18
5.2.120.0070.06311.18
5.2.110.0000.05711.12
5.2.100.0070.04311.25
5.2.90.0070.05011.05
5.2.80.0070.06311.02
5.2.70.0130.05311.18
5.2.60.0070.05011.00
5.2.50.0100.05310.91
5.2.40.0000.06710.95
5.2.30.0070.05710.99
5.2.20.0100.05010.97
5.2.10.0070.05710.93
5.2.00.0070.05710.88
5.1.60.0100.0409.88
5.1.50.0030.05010.03
5.1.40.0000.04310.04
5.1.30.0070.04010.50
5.1.20.0070.05010.39
5.1.10.0070.0509.96
5.1.00.0030.05310.21
5.0.50.0000.0278.65
5.0.40.0070.0408.53
5.0.30.0100.0578.31
5.0.20.0030.0438.31
5.0.10.0070.0238.30
5.0.00.0030.0478.03
4.4.90.0000.0337.18
4.4.80.0030.0307.18
4.4.70.0000.0377.18
4.4.60.0070.0207.18
4.4.50.0000.0337.18
4.4.40.0030.0537.18
4.4.30.0070.0237.18
4.4.20.0030.0307.18
4.4.10.0000.0377.18
4.4.00.0000.0577.18
4.3.110.0000.0377.18
4.3.100.0000.0377.18
4.3.90.0000.0307.18
4.3.80.0030.0237.18
4.3.70.0000.0277.18
4.3.60.0030.0337.18
4.3.50.0070.0307.18
4.3.40.0000.0537.18
4.3.30.0000.0337.18
4.3.20.0070.0337.18
4.3.10.0000.0277.18
4.3.00.0000.0337.18

preferences:
36.47 ms | 401 KiB | 5 Q