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)
5.4.280.0050.05212.41
5.4.270.0070.04812.42
5.4.260.0110.04312.41
5.4.250.0090.04612.42
5.4.240.0090.04512.41
5.4.230.0080.04312.41
5.4.220.0080.04712.41
5.4.210.0080.05112.41
5.4.200.0050.05012.41
5.4.190.0120.04012.40
5.4.180.0050.04612.40
5.4.170.0110.03412.41
5.4.160.0090.03612.41
5.4.150.0120.04012.40
5.4.140.0070.04312.10
5.4.130.0070.04512.07
5.4.120.0080.04612.04
5.4.110.0090.04612.04
5.4.100.0090.04312.04
5.4.90.0050.04612.04
5.4.80.0050.04712.04
5.4.70.0090.04712.04
5.4.60.0080.05312.03
5.4.50.0070.04112.03
5.4.40.0070.03612.02
5.4.30.0050.04312.02
5.4.20.0070.04412.02
5.4.10.0040.04312.01
5.4.00.0070.03811.51
5.3.280.0080.04512.71
5.3.270.0040.05012.72
5.3.260.0090.03812.72
5.3.250.0050.04212.72
5.3.240.0050.04212.72
5.3.230.0090.03912.71
5.3.220.0070.03812.68
5.3.210.0090.04312.68
5.3.200.0080.03612.68
5.3.190.0070.03812.68
5.3.180.0070.03812.67
5.3.170.0070.03812.67
5.3.160.0090.04212.67
5.3.150.0100.04912.67
5.3.140.0090.04512.66
5.3.130.0070.04812.66
5.3.120.0070.04712.66
5.3.110.0070.04912.65
5.3.100.0060.05012.14
5.3.90.0080.04512.12
5.3.80.0110.04512.11
5.3.70.0060.04512.11
5.3.60.0100.04812.09
5.3.50.0100.04612.04
5.3.40.0110.05612.04
5.3.30.0090.05611.99
5.3.20.0080.04711.78
5.3.10.0090.04911.75
5.3.00.0070.04611.73

preferences:
143.68 ms | 1394 KiB | 7 Q