Reputation: 3978
I'm trying to get DateTimeZone object, setting it the following way:
$dateTimeZoneRemote = new DateTimeZone('America/Edmonton');
However printing it out returns an empty object??
print_r( $dateTimeZoneRemote );
returns:
DateTimeZone Object ( )
Running PHP 5.2.17
Upvotes: 0
Views: 217
Reputation: 36924
The problem here is that print_r
/var_dump
/get_object_vars
don't show the properties of DateTimeZone as you expect. This was a bug, fixed in PHP 5.5.
Whatever, using the methods that the class provide, you get the correct result in any version.
$dateTimeZoneRemote = new DateTimeZone('America/Edmonton');
echo $dateTimeZoneRemote->getName(); // print America/Edmonton
Upvotes: 4