3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $var = array('in_monitoring' => new DateTime('now', new DateTimeZone('UTC'))); $json = json_encode($var); echo $json; $arr = json_decode($json); print_r($arr); echo PHP_EOL, $arr['in_monitoring']->timezone;
based on lItfc
Output for 7.2.0
{"in_monitoring":{"date":"2015-11-16 17:26:35.039834","timezone_type":3,"timezone":"UTC"}}stdClass Object ( [in_monitoring] => stdClass Object ( [date] => 2015-11-16 17:26:35.039834 [timezone_type] => 3 [timezone] => UTC ) ) Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/e7m2K:12 Stack trace: #0 {main} thrown in /in/e7m2K on line 12
Process exited with code 255.
Output for 7.1.10
{"in_monitoring":{"date":"2015-11-16 17:26:35.041415","timezone_type":3,"timezone":"UTC"}}stdClass Object ( [in_monitoring] => stdClass Object ( [date] => 2015-11-16 17:26:35.041415 [timezone_type] => 3 [timezone] => UTC ) ) Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/e7m2K:12 Stack trace: #0 {main} thrown in /in/e7m2K on line 12
Process exited with code 255.
Output for 7.1.7
{"in_monitoring":{"date":"2015-11-16 17:26:35.004643","timezone_type":3,"timezone":"UTC"}}stdClass Object ( [in_monitoring] => stdClass Object ( [date] => 2015-11-16 17:26:35.004643 [timezone_type] => 3 [timezone] => UTC ) ) Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/e7m2K:12 Stack trace: #0 {main} thrown in /in/e7m2K on line 12
Process exited with code 255.
Output for 7.1.6
{"in_monitoring":{"date":"2015-11-16 17:26:35.012433","timezone_type":3,"timezone":"UTC"}}stdClass Object ( [in_monitoring] => stdClass Object ( [date] => 2015-11-16 17:26:35.012433 [timezone_type] => 3 [timezone] => UTC ) ) Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/e7m2K:12 Stack trace: #0 {main} thrown in /in/e7m2K on line 12
Process exited with code 255.
Output for 7.1.5
{"in_monitoring":{"date":"2015-11-16 17:26:35.007956","timezone_type":3,"timezone":"UTC"}}stdClass Object ( [in_monitoring] => stdClass Object ( [date] => 2015-11-16 17:26:35.007956 [timezone_type] => 3 [timezone] => UTC ) ) Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/e7m2K:12 Stack trace: #0 {main} thrown in /in/e7m2K on line 12
Process exited with code 255.
Output for 7.1.0
{"in_monitoring":{"date":"2015-11-16 17:26:35.003967","timezone_type":3,"timezone":"UTC"}}stdClass Object ( [in_monitoring] => stdClass Object ( [date] => 2015-11-16 17:26:35.003967 [timezone_type] => 3 [timezone] => UTC ) ) Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/e7m2K:12 Stack trace: #0 {main} thrown in /in/e7m2K on line 12
Process exited with code 255.
Output for 7.0.0 - 7.0.20
{"in_monitoring":{"date":"2015-11-16 17:26:35.000000","timezone_type":3,"timezone":"UTC"}}stdClass Object ( [in_monitoring] => stdClass Object ( [date] => 2015-11-16 17:26:35.000000 [timezone_type] => 3 [timezone] => UTC ) ) Fatal error: Uncaught Error: Cannot use object of type stdClass as array in /in/e7m2K:12 Stack trace: #0 {main} thrown in /in/e7m2K on line 12
Process exited with code 255.
Output for 5.5.14 - 5.6.28
{"in_monitoring":{"date":"2015-11-16 17:26:35.000000","timezone_type":3,"timezone":"UTC"}}stdClass Object ( [in_monitoring] => stdClass Object ( [date] => 2015-11-16 17:26:35.000000 [timezone_type] => 3 [timezone] => UTC ) ) Fatal error: Cannot use object of type stdClass as array in /in/e7m2K on line 12
Process exited with code 255.
Output for 5.5.0 - 5.5.13
{"in_monitoring":{"date":"2015-11-16 17:26:35","timezone_type":3,"timezone":"UTC"}}stdClass Object ( [in_monitoring] => stdClass Object ( [date] => 2015-11-16 17:26:35 [timezone_type] => 3 [timezone] => UTC ) ) Fatal error: Cannot use object of type stdClass as array in /in/e7m2K on line 12
Process exited with code 255.