The code below gets the timezone offset of any city, but i want to trigger an action if the "TimeZoneid" ( The City ) is wrong or not supported at all by PHP
<?php
$dtz = new DateTimeZone('Europe/Berlin');
$time_in_city = new DateTime('now', $dtz);
$TimeZone = $dtz->getOffset( $time_in_city );
if(empty($TimeZone)){
echo "Timezoneid is wrong or not Supported";
}
else{
echo "Timezoneid offset is $TimeZone";
}
?>
When I try to write a wrong TimeZoneid to test my code like this The code does not return anything
$dtz = new DateTimeZone('Europe/Blablabla');
but I want the code to tell me if the city is wrong or not supported.