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 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.2.110.0350.00816.75
7.2.100.0230.01716.41
7.2.90.0380.00616.54
7.2.80.0430.01816.71
7.2.70.0390.00317.00
7.2.60.0150.00816.98
7.2.50.0180.01416.96
7.2.40.0220.01117.18
7.2.30.0230.00516.86
7.2.20.0120.01816.97
7.2.10.0230.00716.83
7.2.00.0100.01018.31
7.1.230.0340.00915.66
7.1.220.0320.00015.71
7.1.210.0320.01115.53
7.1.200.0280.00615.47
7.1.190.0450.00715.30
7.1.180.0250.00415.72
7.1.170.0170.01015.81
7.1.160.0140.01215.67
7.1.150.0060.01515.76
7.1.140.0150.00415.59
7.1.130.0060.01715.61
7.1.120.0050.01915.65
7.1.110.0130.01315.79
7.1.100.0130.00416.88
7.1.90.0170.00815.66
7.1.80.0170.00715.70
7.1.70.0160.00116.58
7.1.60.0110.01517.48
7.1.50.0140.01016.21
7.1.40.0250.00715.79
7.1.30.0250.00615.45
7.1.20.0150.01915.52
7.1.10.0160.01215.74
7.1.00.0120.04219.05
7.0.310.0310.00915.09
7.0.300.0110.01115.18
7.0.290.0200.00315.04
7.0.280.0140.01015.19
7.0.270.0160.00515.46
7.0.260.0070.01315.51
7.0.250.0130.00515.50
7.0.240.0120.00915.18
7.0.230.0070.01815.48
7.0.220.0200.00315.25
7.0.210.0180.00715.35
7.0.200.0070.00916.18
7.0.190.0230.00215.45
7.0.180.0190.00615.46
7.0.170.0150.01115.48
7.0.160.0170.00715.33
7.0.150.0220.00215.50
7.0.140.0100.04018.63
7.0.130.0180.00715.38
7.0.120.0120.01215.48
7.0.110.0220.00415.20
7.0.100.0160.02517.78
7.0.90.0140.02317.67
7.0.80.0120.04517.71
7.0.70.0110.03117.67
7.0.60.0090.05217.70
7.0.50.0100.03017.98
7.0.40.0130.03116.73
7.0.30.0110.04816.93
7.0.20.0120.04416.81
7.0.10.0150.04416.89
7.0.00.0080.04116.76
5.6.380.0280.00414.30
5.6.370.0260.00614.38
5.6.360.0140.01114.66
5.6.350.0130.01314.41
5.6.340.0100.01714.42
5.6.330.0140.01014.13
5.6.320.0160.01314.53
5.6.310.0130.01314.32
5.6.300.0180.00714.29
5.6.290.0160.00414.05
5.6.280.0130.03917.64
5.6.270.0170.00814.33
5.6.260.0040.01914.42
5.6.250.0140.04617.63
5.6.240.0110.02917.52
5.6.230.0110.04317.46
5.6.220.0120.04317.50
5.6.210.0150.04017.64
5.6.200.0110.04217.71
5.6.190.0150.04217.87
5.6.180.0090.04317.78
5.6.170.0060.04917.59
5.6.160.0120.04417.79
5.6.150.0120.04317.82
5.6.140.0080.04817.74
5.6.130.0230.03717.73
5.6.120.0220.04617.83
5.6.110.0150.03617.61
5.6.100.0240.04517.64
5.6.90.0250.04417.77
5.6.80.0190.04917.19
5.6.70.0190.04717.37
5.6.60.0230.04317.31
5.6.50.0170.02917.55
5.6.40.0120.05017.40
5.6.30.0150.04317.44
5.6.20.0070.04717.34
5.6.10.0040.05117.57
5.6.00.0090.04517.30
5.5.380.0070.03015.96
5.5.370.0130.04015.89
5.5.360.0140.03715.81
5.5.350.0080.04515.92
5.5.340.0080.04016.11
5.5.330.0160.03516.27
5.5.320.0100.04216.08
5.5.310.0080.03016.06
5.5.300.0180.03716.12
5.5.290.0190.03815.99
5.5.280.0060.04516.24
5.5.270.0190.03915.98
5.5.260.0110.04716.12
5.5.250.0190.03515.93
5.5.240.0160.03715.76
5.5.230.0180.03815.53
5.5.220.0150.04315.58
5.5.210.0130.04015.78
5.5.200.0130.04015.69
5.5.190.0130.04515.79
5.5.180.0080.03315.60
5.5.170.0140.01114.52
5.5.160.0120.04215.61
5.5.150.0050.04315.53
5.5.140.0060.04815.67
5.5.130.0100.02415.54
5.5.120.0070.04615.66
5.5.110.0120.02715.79
5.5.100.0140.03515.64
5.5.90.0100.04315.63
5.5.80.0090.04415.54
5.5.70.0110.04615.73
5.5.60.0080.03215.61
5.5.50.0130.03815.65
5.5.40.0100.04215.54
5.5.30.0170.03615.50
5.5.20.0130.04015.58
5.5.10.0050.05015.55
5.5.00.0120.02315.64
5.4.450.0060.04215.43
5.4.440.0160.04315.36
5.4.430.0100.04315.21
5.4.420.0140.04215.22
5.4.410.0140.03915.01
5.4.400.0130.03715.14
5.4.390.0160.04115.18
5.4.380.0170.03714.94
5.4.370.0130.03815.06
5.4.360.0100.03915.14
5.4.350.0160.03214.97
5.4.340.0050.04915.09
5.4.330.0130.00511.10
5.4.320.0120.03814.98
5.4.310.0150.03815.09
5.4.300.0100.03415.18
5.4.290.0080.02815.14
5.4.280.0140.03815.23
5.4.270.0120.04015.20
5.4.260.0080.02615.01
5.4.250.0120.02515.23
5.4.240.0130.04215.09
5.4.230.0080.04315.04
5.4.220.0090.04314.92
5.4.210.0080.04315.00
5.4.200.0150.03815.03
5.4.190.0050.03115.15
5.4.180.0140.03715.04
5.4.170.0100.04214.97
5.4.160.0060.02915.05
5.4.150.0100.03614.98
5.4.140.0060.04113.93
5.4.130.0080.03913.70
5.4.120.0090.03913.85
5.4.110.0120.03313.77
5.4.100.0080.03313.81
5.4.90.0090.03713.82
5.4.80.0100.03013.76
5.4.70.0090.03813.79
5.4.60.0050.03813.87
5.4.50.0150.03313.86
5.4.40.0090.04013.81
5.4.30.0080.04013.70
5.4.20.0100.03913.91
5.4.10.0090.03913.77
5.4.00.0100.02013.44
5.3.290.0080.04512.68
5.3.280.0080.02412.58
5.3.270.0080.02812.71
5.3.260.0100.04512.63
5.3.250.0090.02812.61
5.3.240.0050.03312.61
5.3.230.0050.04812.51
5.3.220.0080.04212.46
5.3.210.0120.02512.63
5.3.200.0090.03512.61
5.3.190.0120.03712.62
5.3.180.0020.04712.65
5.3.170.0070.02412.51
5.3.160.0070.04012.65
5.3.150.0080.03412.66
5.3.140.0110.03712.49
5.3.130.0120.03712.50
5.3.120.0110.04012.64
5.3.110.0090.03712.57
5.3.100.0070.03012.38
5.3.90.0110.03812.39
5.3.80.0090.04412.32
5.3.70.0090.03912.31
5.3.60.0100.03512.28
5.3.50.0030.02812.29
5.3.40.0140.03412.17
5.3.30.0050.04212.17
5.3.20.0100.03312.19
5.3.10.0070.03112.10
5.3.00.0090.03311.98
5.2.170.0080.01810.73
5.2.160.0060.03110.77
5.2.150.0080.03510.81
5.2.140.0050.02910.73
5.2.130.0050.03410.71
5.2.120.0050.02510.79
5.2.110.0060.03410.80
5.2.100.0060.03010.81
5.2.90.0100.01910.75
5.2.80.0110.01810.79
5.2.70.0070.03010.76
5.2.60.0040.03410.70
5.2.50.0040.03410.74
5.2.40.0100.02010.66
5.2.30.0070.02210.70
5.2.20.0090.02810.74
5.2.10.0050.02710.66
5.2.00.0020.03210.54
5.1.60.0110.02210.15
5.1.50.0050.02810.20
5.1.40.0090.01310.23
5.1.30.0050.02810.39
5.1.20.0100.03010.41
5.1.10.0050.03010.28
5.1.00.0060.02810.25
5.0.50.0070.0109.47
5.0.40.0000.0269.41
5.0.30.0080.0309.35
5.0.20.0080.0179.36
5.0.10.0040.0219.33
5.0.00.0020.0399.29
4.4.90.0020.0218.63
4.4.80.0050.0178.63
4.4.70.0010.0208.63
4.4.60.0020.0208.63
4.4.50.0020.0208.63
4.4.40.0030.0278.63
4.4.30.0030.0138.63
4.4.20.0030.0168.63
4.4.10.0030.0188.63
4.4.00.0070.0258.63
4.3.110.0000.0188.63
4.3.100.0020.0188.63
4.3.90.0020.0218.63
4.3.80.0030.0278.63
4.3.70.0070.0158.63
4.3.60.0020.0208.63
4.3.50.0050.0178.63
4.3.40.0030.0298.63
4.3.30.0040.0188.63
4.3.20.0010.0218.63
4.3.10.0000.0248.63
4.3.00.0040.0178.63

preferences:
35.76 ms | 401 KiB | 5 Q