<?php class Foo { public $a = 1; protected $b = 1; public function __set($key, $val) { $this->$key = $val; } } $f = new Foo(); $f->a = 2; $f->b = 2; print_r($f);
You have javascript disabled. You will not be able to edit any code.