Skip to content

Instantly share code, notes, and snippets.

@Mr-Kumar-Abhishek
Forked from midorikocak/brainfuck.php
Created April 18, 2016 21:13
Show Gist options
  • Save Mr-Kumar-Abhishek/7c3a0ce8103e4643f257da8156e5b123 to your computer and use it in GitHub Desktop.
Save Mr-Kumar-Abhishek/7c3a0ce8103e4643f257da8156e5b123 to your computer and use it in GitHub Desktop.
<?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