3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class Foo { public $a = 42; } $obj = new Foo; unset($obj->a); $arr = (object) $obj; var_dump(count($arr)); var_dump($arr);
based on jP5Pm
Output for 7.2.0 - 7.2.6
Warning: count(): Parameter must be an array or an object that implements Countable in /in/ucrTU on line 10 int(1) object(Foo)#1 (0) { }
Output for 5.3.19 - 7.1.20
int(1) object(Foo)#1 (0) { }