3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $key; public $link; function __destruct() { global $flag; global $permit; if($permit==1) echo $flag; } function __wakeup() { exit("nonono"); } } class B { public $key; public $link; function __destruct() { global $file; global $flag; $flag="get_flag_contents"; } function __wakeup() { global $file; $this->key=1; $file='index.php'; } function __toString() { if($link->key==0){ global $file; $file='flag.php'; return "WOW!!!"; } } } class C { public $key; public $link; function __destruct() { if($this->link->key==1) echo $this->link; } function __wakeup() { exit("nonono"); } } class D { public $key; public $link; function __destruct() { global $permit; $permit=1; $this->key=0; echo "OK!YOU CAN PASS"; } function __wakeup() { exit("nonono"); } } class E { public $key; public $link; function __destruct() { global $permit; $permit=0; } function __wakeup() { $this->key=0; phpinfo(); } } unserialize($_GET['yoyo']); class A { public $key; public $link; function __destruct() { global $flag; global $permit; if($permit==1) echo $flag; } function __wakeup() { exit("nonono"); } } class B { public $key; public $link; function __destruct() { global $file; global $flag; $flag=base64_encode(file_get_contents($file)); } function __wakeup() { global $file; $this->key=1; $file='index.php'; } function __toString() { if($link->key==0){ global $file; $file='flag.php'; return "WOW!!!"; } } } class C { public $key; public $link; function __destruct() { if($this->link->key==1) echo $this->link; } function __wakeup() { exit("nonono"); } } class D { public $key; public $link; function __destruct() { global $permit; $permit=1; $this->key=0; echo "OK!YOU CAN PASS"; } function __wakeup() { exit("nonono"); } } class E { public $key; public $link; function __destruct() { global $permit; $permit=0; } function __wakeup() { $this->key=0; phpinfo(); } } unserialize($_GET['yoyo']);class A { public $key; public $link; function __destruct() { global $flag; global $permit; if($permit==1) echo $flag; } function __wakeup() { exit("nonono"); } } class B { public $key; public $link; function __destruct() { global $file; global $flag; $flag=base64_encode(file_get_contents($file)); } function __wakeup() { global $file; $this->key=1; $file='index.php'; } function __toString() { if($link->key==0){ global $file; $file='flag.php'; return "WOW!!!"; } } } class C { public $key; public $link; function __destruct() { if($this->link->key==1) echo $this->link; } function __wakeup() { exit("nonono"); } } class D { public $key; public $link; function __destruct() { global $permit; $permit=1; $this->key=0; echo "OK!YOU CAN PASS"; } function __wakeup() { exit("nonono"); } } class E { public $key; public $link; function __destruct() { global $permit; $permit=0; } function __wakeup() { $this->key=0; phpinfo(); } } $ser = 'O:1:"C":2:{s:3:"key";N;s:4:"link";O:1:"B":2:{s:3:"key";i:1;s:4:"link";N;}}'; unserialize($ser);

preferences:
23.66 ms | 407 KiB | 5 Q