Last active
April 18, 2016 21:13
-
-
Save midorikocak/c5325d19699254f6926af8eebdd1ee8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class Brainfuck | |
{ | |
public $ref; | |
function &__get($x) { | |
$this->ref = new class($this->ref) { | |
private $p; | |
function __construct(&$p) { | |
$this->p = &$p; | |
} | |
function __isset($x) { | |
$this->p = new Brainfuck; | |
return false; | |
} | |
function __get($x) { | |
} | |
function __set($x, $y) { | |
$this->$x = $y; | |
} | |
}; | |
return $this->ref; | |
} | |
function __set($x, $y) { /* not called */ | |
var_dump($x, $y); | |
} | |
function __isset($x) { | |
return true; | |
} | |
} | |
$a = new Brainfuck; | |
$a->b->c = $a->b->c ?? 2; | |
$a->b->c ??= $b; | |
isset($a->b) ? ( $_ = $a->b; $_->c ?? $_->c = $b ) : $a->b->c = $b; | |
var_dump($a); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment