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 CryptToken::GetInstance()->Crypt('user=anonymous|ts=' . (time() + (7 * 24 * 60 * 60)));

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.0070.01014.93
7.4.00.0060.01315.05
7.3.130.0060.00615.10
7.3.120.0060.01014.79
7.3.110.0060.01214.96
7.3.100.0060.00614.97
7.3.90.0040.01114.68
7.3.80.0040.00814.93
7.3.70.0000.00914.88
7.3.60.0030.00814.57
7.3.50.0070.00714.91
7.3.40.0000.01014.75
7.3.30.0030.00614.74
7.3.20.0030.00716.52
7.3.10.0020.01316.57
7.3.00.0070.00716.58
7.2.260.0060.01415.16
7.2.250.0060.01115.03
7.2.240.0100.00715.37
7.2.230.0030.00915.41
7.2.220.0050.00514.99
7.2.210.0000.01415.12
7.2.200.0040.00414.79
7.2.190.0120.00415.21
7.2.180.0090.00615.02
7.2.170.0030.00715.20
7.2.160.0120.00315.30
7.2.150.0060.00917.00
7.2.140.0040.00717.02
7.2.130.0060.00717.03
7.2.120.0080.00716.91
7.2.110.0040.00817.00
7.2.100.0050.00916.91
7.2.90.0070.00817.04
7.2.80.0090.00716.83
7.2.70.0070.00716.83
7.2.60.0030.00916.97
7.2.50.0060.01116.84
7.2.40.0080.00516.94
7.2.30.0080.00817.00
7.2.20.0050.01016.93
7.2.10.0060.00616.91
7.2.00.0060.00817.55
7.1.330.0040.00815.75
7.1.320.0000.01715.66
7.1.310.0110.00015.61
7.1.300.0040.01215.80
7.1.290.0070.01015.79
7.1.280.0030.00915.89
7.1.270.0040.00415.77
7.1.260.0030.01015.68
7.1.250.0040.00915.68
7.1.240.0030.00715.67
7.1.230.0020.01115.44
7.1.220.0070.00615.72
7.1.210.0030.00815.74
7.1.200.0090.00215.80
7.1.190.0020.01015.63
7.1.180.0020.01515.86
7.1.170.0040.00715.79
7.1.160.0060.00615.72
7.1.150.0100.00415.56
7.1.140.0040.00815.76
7.1.130.0020.00915.53
7.1.120.0030.00915.74
7.1.110.0060.00815.84
7.1.100.0070.00416.52
7.1.90.0030.00715.74
7.1.80.0030.01215.75
7.1.70.0060.00816.18
7.1.60.0080.00916.84
7.1.50.0050.01015.89
7.1.40.0040.00915.90
7.1.30.0070.00615.83
7.1.20.0060.00515.78
7.1.10.0050.00915.85
7.1.00.0100.02317.98
7.0.330.0050.00715.36
7.0.320.0040.00915.43
7.0.310.0040.00615.29
7.0.300.0060.00715.29
7.0.290.0060.00615.41
7.0.280.0020.01115.40
7.0.270.0030.01015.44
7.0.260.0100.00315.46
7.0.250.0070.00515.54
7.0.240.0020.00815.37
7.0.230.0030.01015.51
7.0.220.0020.00915.54
7.0.210.0100.00315.29
7.0.200.0010.01015.79
7.0.190.0080.00615.30
7.0.180.0090.00515.43
7.0.170.0060.00815.37
7.0.160.0070.00515.53
7.0.150.0040.00915.46
7.0.140.0060.03017.59
7.0.130.0060.00815.52
7.0.120.0040.00715.52
7.0.110.0090.00315.45
7.0.100.0050.02017.56
7.0.90.0070.01817.49
7.0.80.0050.01717.48
7.0.70.0060.01517.35
7.0.60.0050.01717.51
7.0.50.0060.01517.80
7.0.40.0070.01615.74
7.0.30.0040.01715.72
7.0.20.0030.02315.54
7.0.10.0070.01515.61
7.0.00.0050.01815.71
5.6.400.0130.00714.55
5.6.390.0060.00614.27
5.6.380.0050.00814.44
5.6.370.0000.01214.53
5.6.360.0070.00714.34
5.6.350.0070.00414.41
5.6.340.0050.01114.33
5.6.330.0080.00714.30
5.6.320.0050.00814.37
5.6.310.0060.00414.39
5.6.300.0050.01014.51
5.6.290.0070.00514.51
5.6.280.0040.03516.61
5.6.270.0050.00514.34
5.6.260.0070.00714.32
5.6.250.0070.03016.50
5.6.240.0030.02116.42
5.6.230.0030.02116.38
5.6.220.0070.01516.54
5.6.210.0030.03016.28
5.6.200.0080.02216.61
5.6.190.0060.02016.58
5.6.180.0040.01916.62
5.6.170.0000.02516.80
5.6.160.0070.01616.63
5.6.150.0080.01916.76
5.6.140.0040.01916.71
5.6.130.0060.01616.65
5.6.120.0050.03016.54
5.6.110.0040.01816.54
5.6.100.0020.02016.58
5.6.90.0010.02416.62
5.6.80.0020.01716.38
5.6.70.0030.01916.45
5.6.60.0040.01516.30
5.6.50.0060.01816.23
5.6.40.0040.01816.41
5.6.30.0060.01916.44
5.6.20.0040.02716.41
5.6.10.0040.02216.28
5.6.00.0040.03416.40
5.5.380.0020.01915.27
5.5.370.0040.01915.32
5.5.360.0050.01615.29
5.5.350.0050.02415.38
5.5.340.0070.01315.48
5.5.330.0060.01515.52
5.5.320.0050.01715.51
5.5.310.0060.01615.44
5.5.300.0060.01415.51
5.5.290.0070.01615.39
5.5.280.0050.01615.59
5.5.270.0060.01715.64
5.5.260.0010.02115.65
5.5.250.0050.01515.52
5.5.240.0050.01815.34
5.5.230.0040.01815.31
5.5.220.0030.01715.14
5.5.210.0050.02015.34
5.5.200.0070.01715.31
5.5.190.0040.02015.23
5.5.180.0020.03115.23
5.5.170.0060.00712.89
5.5.160.0030.02915.19
5.5.150.0050.02415.19
5.5.140.0060.02815.36
5.5.130.0060.02615.26
5.5.120.0010.02715.13
5.5.110.0050.03015.28
5.5.100.0060.02215.27
5.5.90.0010.03415.30
5.5.80.0050.03215.29
5.5.70.0070.02715.26
5.5.60.0100.02715.04
5.5.50.0040.02115.21
5.5.40.0040.02715.22
5.5.30.0080.02615.22
5.5.20.0060.03015.23
5.5.10.0050.02715.22
5.5.00.0050.02715.19
5.4.450.0020.01714.14
5.4.440.0030.01314.16
5.4.430.0010.03114.05
5.4.420.0080.01914.08
5.4.410.0040.01713.95
5.4.400.0030.01513.95
5.4.390.0020.02113.97
5.4.380.0030.01614.00
5.4.370.0030.02013.95
5.4.360.0020.01913.79
5.4.350.0030.01813.91
5.4.340.0060.02113.93
5.4.330.0020.00911.46
5.4.320.0020.02214.07
5.4.310.0040.02913.93
5.4.300.0040.02613.84
5.4.290.0030.01813.97
5.4.280.0020.02013.90
5.4.270.0030.02213.88
5.4.260.0050.02713.90
5.4.250.0040.02913.89
5.4.240.0030.03313.87
5.4.230.0030.02114.04
5.4.220.0040.03213.87
5.4.210.0050.02813.99
5.4.200.0060.02813.99
5.4.190.0010.03213.83
5.4.180.0010.02613.99
5.4.170.0040.02613.81
5.4.160.0030.02413.83
5.4.150.0060.02713.98
5.4.140.0040.02412.99
5.4.130.0040.02113.09
5.4.120.0030.02913.04
5.4.110.0010.02113.08
5.4.100.0040.02513.18
5.4.90.0050.02713.00
5.4.80.0010.02113.12
5.4.70.0050.02613.17
5.4.60.0020.01913.17
5.4.50.0040.02913.06
5.4.40.0010.02613.04
5.4.30.0050.02213.12
5.4.20.0060.02213.09
5.4.10.0030.02912.99
5.4.00.0060.02412.85
5.3.290.0020.02712.34
5.3.280.0030.02412.32
5.3.270.0030.02812.37
5.3.260.0020.03112.38
5.3.250.0020.03112.34
5.3.240.0010.02012.31
5.3.230.0070.01612.35
5.3.220.0020.01912.25
5.3.210.0060.02612.33
5.3.200.0020.03012.32
5.3.190.0020.02512.28
5.3.180.0080.02612.26
5.3.170.0050.02512.35
5.3.160.0040.02912.36
5.3.150.0040.02712.30
5.3.140.0060.02112.31
5.3.130.0040.02512.34
5.3.120.0010.03012.20
5.3.110.0040.02212.26
5.3.100.0080.02612.06
5.3.90.0030.02512.12
5.3.80.0020.02812.05
5.3.70.0050.02812.14
5.3.60.0040.02612.12
5.3.50.0060.01512.12
5.3.40.0060.02712.12
5.3.30.0060.02812.06
5.3.20.0060.02911.99
5.3.10.0070.02611.94
5.3.00.0040.02711.91
5.2.170.0060.02710.80
5.2.160.0050.02910.80
5.2.150.0060.01810.80
5.2.140.0020.03710.80
5.2.130.0060.03210.80
5.2.120.0060.03410.80
5.2.110.0070.02710.80
5.2.100.0030.02010.80
5.2.90.0050.01710.80
5.2.80.0020.03310.80
5.2.70.0070.01510.80
5.2.60.0010.03610.80
5.2.50.0040.03210.80
5.2.40.0030.02310.80
5.2.30.0020.02410.80
5.2.20.0030.03210.80
5.2.10.0030.02110.80
5.2.00.0030.03310.80
5.1.60.0020.02310.80
5.1.50.0040.02310.80
5.1.40.0050.02510.80
5.1.30.0030.02910.80
5.1.20.0070.02810.80
5.1.10.0020.02910.80
5.1.00.0050.02910.80
5.0.50.0030.01310.80
5.0.40.0020.02210.80
5.0.30.0040.03210.80
5.0.20.0020.02310.80
5.0.10.0030.01410.80
5.0.00.0030.03310.80
4.4.90.0010.01610.80
4.4.80.0020.02010.80
4.4.70.0020.01710.80
4.4.60.0000.02110.80
4.4.50.0020.01310.80
4.4.40.0050.02510.80
4.4.30.0010.01910.80
4.4.20.0030.01810.80
4.4.10.0000.02010.80
4.4.00.0030.01810.80
4.3.110.0030.01610.80
4.3.100.0020.01910.80
4.3.90.0000.02210.80
4.3.80.0040.02710.80
4.3.70.0050.01310.80
4.3.60.0030.01210.80
4.3.50.0030.01710.80
4.3.40.0020.02010.80
4.3.30.0030.01910.80
4.3.20.0030.01810.80
4.3.10.0050.01710.80
4.3.00.0020.01610.80

preferences:
36.4 ms | 400 KiB | 5 Q