3v4l.org

run code in 300+ PHP versions simultaneously
<?php class word{ private $text; public function __construct($word){ $this->text=$word; } public function setWord($word){ $this->text=$word; } public function getWord() { return $this->text; } } $class_words = array(); $word = new word("this"); $class_words[] = $word->getWord(); $word->setWord("that"); $class_words[] = $word->getWord(); print_r($class_words); exit;

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
151.95 ms | 2247 KiB | 11 Q