3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class TransactionId { private $id; public function __construct($id) { $this->id = $id; } public function __troString() { return $this->id; } } echo json_encode(array('id' => (string) new TransactionId('asdfgbhbva')));
based on uO0l2
Output for 7.1.0 - 7.2.0
Recoverable fatal error: Object of class TransactionId could not be converted to string in /in/H8ZHa on line 16
Process exited with code 255.
Output for 5.4.0 - 7.0.20
Catchable fatal error: Object of class TransactionId could not be converted to string in /in/H8ZHa on line 16
Process exited with code 255.