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));
Output for 5.4.0 - 5.4.28
Parse error: syntax error, unexpected 'echo' (T_ECHO), expecting ',' or ';' in /in/FM4G8 on line 75
Process exited with code 255.
Output for 5.3.0 - 5.3.28
Parse error: syntax error, unexpected T_ECHO, expecting ',' or ';' in /in/FM4G8 on line 75
Process exited with code 255.

preferences:
179.06 ms | 1395 KiB | 65 Q