3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function __get($name) { $pos = strpos($name, '#'); if ($pos !== false && $pos != 0 ) { $func = substr($name, 0, $pos); return $this->$func(); } else { return $name; } } private function a() { return "f:a"; } } $a = new A(); echo $a->a; $p = "a#a"; echo $a->$p;

preferences:
35.16 ms | 402 KiB | 5 Q