3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class C { private static $arr = array(); public function get() { return self::$arr; } } $arr = &C::get(); $arr[] = 0; var_dump($arr); var_dump(C::get());
Output for 7.0.0 - 7.2.0
Deprecated: Non-static method C::get() should not be called statically in /in/OD9YZ on line 8 Notice: Only variables should be assigned by reference in /in/OD9YZ on line 8 array(1) { [0]=> int(0) } Deprecated: Non-static method C::get() should not be called statically in /in/OD9YZ on line 11 array(0) { }
Output for 5.3.19 - 5.6.28
Strict Standards: Non-static method C::get() should not be called statically in /in/OD9YZ on line 8 Strict Standards: Only variables should be assigned by reference in /in/OD9YZ on line 8 array(1) { [0]=> int(0) } Strict Standards: Non-static method C::get() should not be called statically in /in/OD9YZ on line 11 array(0) { }