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 "<br>"; 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.4.10.0000.01816.49
7.4.00.0040.01215.93
7.3.130.0130.00016.56
7.3.120.0050.01215.67
7.3.110.0090.00615.66
7.3.100.0110.00615.69
7.3.90.0020.01115.54
7.3.80.0020.01415.70
7.3.70.0020.01115.69
7.3.60.0020.01015.64
7.3.50.0090.00915.65
7.3.40.0060.00915.60
7.3.30.0060.00815.61
7.3.20.0080.00417.40
7.3.10.0060.01017.14
7.3.00.0030.01117.21
7.2.260.0040.01516.63
7.2.250.0090.00815.68
7.2.240.0080.00815.77
7.2.230.0080.00615.77
7.2.220.0050.00715.97
7.2.210.0080.00615.82
7.2.200.0020.01215.87
7.2.190.0060.00915.86
7.2.180.0030.01215.83
7.2.170.0040.01215.83
7.2.160.0080.00416.59
7.2.150.0030.01118.41
7.2.140.0070.01118.44
7.2.130.0090.00917.74
7.2.120.0020.01317.80
7.2.110.0060.01117.69
7.2.100.0050.01017.64
7.2.90.0050.01017.64
7.2.80.0080.00617.81
7.2.70.0050.01017.70
7.2.60.0060.00917.46
7.2.50.0060.00917.65
7.2.40.0090.00317.66
7.2.30.0070.00517.80
7.2.20.0110.00817.72
7.2.10.0110.00717.61
7.2.00.0060.00718.33
7.1.330.0070.00716.66
7.1.320.0020.01216.70
7.1.310.0050.01116.38
7.1.300.0060.00616.44
7.1.290.0050.00916.56
7.1.280.0060.00716.36
7.1.270.0050.00716.52
7.1.260.0090.00416.44
7.1.250.0040.00916.56
7.1.240.0070.00717.21
7.1.230.0000.01717.11
7.1.220.0080.00417.41
7.1.210.0030.00717.11
7.1.200.0070.00716.58
7.1.190.0040.01117.41
7.1.180.0030.01117.27
7.1.170.0070.01017.18
7.1.160.0100.00717.29
7.1.150.0030.01017.13
7.1.140.0060.00917.15
7.1.130.0070.00717.31
7.1.120.0070.00417.18
7.1.110.0060.00317.41
7.1.100.0080.00417.65
7.1.90.0000.00917.20
7.1.80.0000.01017.16
7.1.70.0060.00617.30
7.1.60.0110.00918.46
7.1.50.0110.00716.86
7.1.40.0090.00017.45
7.1.30.0060.00917.21
7.1.20.0110.00417.35
7.1.10.0100.00317.25
7.1.00.0030.04219.79
7.0.330.0090.00316.88
7.0.320.0030.00617.09
7.0.310.0000.01016.96
7.0.300.0080.00417.13
7.0.290.0110.00017.00
7.0.280.0100.00716.90
7.0.270.0110.00016.83
7.0.260.0030.00617.01
7.0.250.0060.00616.89
7.0.240.0060.00616.93
7.0.230.0040.00417.04
7.0.220.0060.00316.95
7.0.210.0030.01316.91
7.0.200.0150.00416.60
7.0.190.0100.00016.86
7.0.180.0030.01016.88
7.0.170.0100.00317.04
7.0.160.0060.00917.00
7.0.150.0030.01017.08
7.0.140.0030.03919.50
7.0.130.0030.01017.11
7.0.120.0060.00617.00
7.0.110.0040.00917.00
7.0.100.0090.04118.51
7.0.90.0080.04518.52
7.0.80.0080.03018.42
7.0.70.0030.04318.56
7.0.60.0080.04318.49
7.0.50.0050.04418.67
7.0.40.0080.04617.51
7.0.30.0050.04717.63
7.0.20.0080.04317.48
7.0.10.0030.04317.38
7.0.00.0070.04417.52
5.6.400.0030.01616.09
5.6.390.0110.00315.84
5.6.380.0080.00415.85
5.6.370.0030.00616.06
5.6.360.0040.00816.02
5.6.350.0080.00816.04
5.6.340.0000.01615.96
5.6.330.0000.01016.00
5.6.320.0000.01115.95
5.6.310.0000.01515.94
5.6.300.0040.01115.78
5.6.290.0070.00415.96
5.6.280.0080.04018.54
5.6.270.0030.01016.10
5.6.260.0090.00616.04
5.6.250.0050.02818.39
5.6.240.0090.04218.33
5.6.230.0020.03118.40
5.6.220.0080.03318.41
5.6.210.0130.04018.24
5.6.200.0130.03518.67
5.6.190.0100.04718.44
5.6.180.0080.04318.60
5.6.170.0120.04518.44
5.6.160.0080.02018.71
5.6.150.0100.04018.38
5.6.140.0110.02718.60
5.6.130.0070.04218.59
5.6.120.0100.04218.48
5.6.110.0080.03818.40
5.6.100.0090.04118.56
5.6.90.0070.04718.41
5.6.80.0030.04718.21
5.6.70.0020.02918.20
5.6.60.0080.04318.24
5.6.50.0020.05118.17
5.6.40.0020.03118.19
5.6.30.0070.04518.21
5.6.20.0130.03718.20
5.6.10.0100.03818.29
5.6.00.0070.04418.21
5.5.380.0070.04718.18
5.5.370.0000.05118.12
5.5.360.0050.03418.16
5.5.350.0130.03618.20
5.5.340.0050.05018.49
5.5.330.0060.04118.47
5.5.320.0070.04618.37
5.5.310.0120.02118.25
5.5.300.0050.04518.36
5.5.290.0070.02318.49
5.5.280.0070.04318.51
5.5.270.0090.02518.41
5.5.260.0060.03018.42
5.5.250.0050.04518.13
5.5.240.0060.03618.09
5.5.230.0100.03918.00
5.5.220.0080.04018.17
5.5.210.0080.04318.04
5.5.200.0050.03918.08
5.5.190.0120.04217.93
5.5.180.0080.04018.13
5.5.170.0060.00915.88
5.5.160.0090.04018.10
5.5.150.0070.04418.05
5.5.140.0080.04318.09
5.5.130.0100.03818.06
5.5.120.0080.03618.06
5.5.110.0030.04917.99
5.5.100.0120.03418.00
5.5.90.0100.02317.97
5.5.80.0050.04517.90
5.5.70.0030.03017.98
5.5.60.0090.03717.90
5.5.50.0070.03317.98
5.5.40.0130.04017.98
5.5.30.0120.02217.92
5.5.20.0080.04517.99
5.5.10.0050.03917.99
5.5.00.0030.03017.90
5.4.450.0050.02216.18
5.4.440.0090.04316.16
5.4.430.0060.04616.21
5.4.420.0050.04516.01
5.4.410.0070.03516.05
5.4.400.0030.02615.75
5.4.390.0040.02615.81
5.4.380.0020.04415.88
5.4.370.0050.03116.06
5.4.360.0130.03515.87
5.4.350.0040.04215.99
5.4.340.0020.04515.97
5.4.330.0060.00312.73
5.4.320.0030.04515.88
5.4.310.0100.03315.88
5.4.300.0070.03915.89
5.4.290.0040.03015.77
5.4.280.0070.04015.96
5.4.270.0080.02315.79
5.4.260.0080.02815.92
5.4.250.0070.04115.77
5.4.240.0050.02615.95
5.4.230.0120.02716.07
5.4.220.0080.02315.90
5.4.210.0050.03315.98
5.4.200.0110.03815.90
5.4.190.0050.04515.82
5.4.180.0030.03715.85
5.4.170.0080.04115.94
5.4.160.0020.02915.80
5.4.150.0030.02715.93
5.4.140.0050.02314.53
5.4.130.0050.02614.56
5.4.120.0070.03814.55
5.4.110.0030.02914.55
5.4.100.0090.03814.64
5.4.90.0070.02214.54
5.4.80.0030.03714.71
5.4.70.0030.04014.53
5.4.60.0050.02014.59
5.4.50.0050.04014.62
5.4.40.0050.04114.63
5.4.30.0030.04314.60
5.4.20.0070.04214.64
5.4.10.0070.03914.64
5.4.00.0110.01914.35
5.3.290.0080.03313.92
5.3.280.0070.04213.88
5.3.270.0060.03813.92
5.3.260.0110.03313.88
5.3.250.0050.03413.78
5.3.240.0060.04113.81
5.3.230.0030.04313.86
5.3.220.0050.04113.77
5.3.210.0050.04213.84
5.3.200.0080.02013.86
5.3.190.0050.04013.76
5.3.180.0090.02814.02
5.3.170.0100.03613.80
5.3.160.0020.02813.92
5.3.150.0070.04113.81
5.3.140.0050.04213.88
5.3.130.0080.03813.79
5.3.120.0000.03613.90
5.3.110.0050.04613.86
5.3.100.0030.03813.59
5.3.90.0030.04413.66
5.3.80.0080.03613.58
5.3.70.0070.03813.53
5.3.60.0080.04013.54
5.3.50.0050.03813.58
5.3.40.0050.03813.52
5.3.30.0050.02113.42
5.3.20.0100.02013.41
5.3.10.0030.03813.33
5.3.00.0020.04213.24
5.2.170.0100.06311.31
5.2.160.0130.04311.16
5.2.150.0070.04711.19
5.2.140.0000.03711.16
5.2.130.0070.02711.20
5.2.120.0030.03011.18
5.2.110.0000.05711.04
5.2.100.0070.03711.06
5.2.90.0170.04711.14
5.2.80.0000.04711.18
5.2.70.0070.06311.12
5.2.60.0000.04011.09
5.2.50.0000.04711.14
5.2.40.0130.05310.96
5.2.30.0100.06011.02
5.2.20.0000.07010.89
5.2.10.0070.05710.95
5.2.00.0070.04310.76
5.1.60.0070.04710.03
5.1.50.0030.0579.86
5.1.40.0130.04010.00
5.1.30.0100.04310.39
5.1.20.0030.04710.41
5.1.10.0100.03310.15
5.1.00.0000.04310.09
5.0.50.0100.0408.42
5.0.40.0030.0208.52
5.0.30.0030.0338.09
5.0.20.0030.0438.22
5.0.10.0030.0378.09
5.0.00.0000.0608.30
4.4.90.0030.0337.02
4.4.80.0000.0377.02
4.4.70.0000.0407.02
4.4.60.0030.0337.02
4.4.50.0100.0277.02
4.4.40.0000.0507.02
4.4.30.0030.0337.02
4.4.20.0070.0137.02
4.4.10.0030.0337.02
4.4.00.0070.0377.02
4.3.110.0000.0207.02
4.3.100.0000.0207.02
4.3.90.0070.0277.02
4.3.80.0000.0477.02
4.3.70.0070.0277.02
4.3.60.0000.0377.02
4.3.50.0130.0107.02
4.3.40.0000.0337.02
4.3.30.0100.0307.02
4.3.20.0000.0337.02
4.3.10.0070.0337.02
4.3.00.0030.0307.02

preferences:
43.94 ms | 401 KiB | 5 Q