3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $test1 = 'hello'; protected $test2 = 'world'; protected $test3; public function toArray() { $this->test1 = null; $this->test3 = false; $array = get_object_vars($this); return array_filter($array, array($this, array($this, 'strlen'))); } } $a = new A(); //print_r(array_filter(array(1,2,false,null), array($this, 'strlen'))); exit(); print_r($a->toArray());

preferences:
43.11 ms | 402 KiB | 5 Q