3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $_locations = array(); public $test = array(); private $_test = array(); public function getResult() { var_dump($this->_locations = true); // works var_dump($this->_locations = "test"); // works var_dump($this->_locations = array()); // works var_dump($this->_locations = array("test")); // produces a critical error var_dump($this->_locations = array("test" => "test")); // produces a critical error var_dump($this->_locations[] = "test"); // produces a critical error var_dump($this->_locations["test"] = "test"); // produces a critical error var_dump($test = array("test" => "test")); // works var_dump($this->test = array()); // works var_dump($this->test = array("test")); // works var_dump($this->_test = array()); // works var_dump($this->_test = array("test")); // works } } $obj = new A(); $obj->getResult();

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
153.01 ms | 1928 KiB | 11 Q