3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $name; public $age; public $likes; function __construct($name, $age, $likes) { $this->name = $name; $this->age = $age; $this->likes = $likes; } function __get($property) { if (property_exists($this, $property)) { return $this->$property; } else { return "Not available"; } } } $user1 = new Test("Sam", 18, "coding"); $jsonData = json_encode($user1); ?> <form action="process.php" method="get"> <input type="hidden" name="data" value="<?= $jsonData; ?>"> <input type="submit" value="go"> </form>

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
162.79 ms | 1752 KiB | 12 Q