My web host recently migrated to a new server and in the process upgraded to PHP5.4
I have a snippet that was doing timezone conversion, but since the upgrade the script stops dead on a certain line in the snippet, and though a web page is displayed, none of the content (including html) displays beyond that PHP line.
Here is the code with the problem lines commented out:
<?php
$timestamp = strtotime($create);
$dtzone = new DateTimeZone($tz);
$time = date('r', $timestamp);
/* Problem code begins here
$dtime = new DateTime($time);
$dtime->setTimeZone($dtzone);
$time = $dtime->format('F d, Y');
Problem code ends here*/
echo $time;
?>
$create
and $tz
are values drawn from a database and are specifically a creation date for the row and a timezone. By commenting out the three lines the rest of the script proceeds OK. Can anyone see what could be wrong here. If I run it on a WAMP server using PHP v 5.4.3 the thing is fine. If you can see what is wrong an explanation as well as a correction would be most welcome. (I have no idea how to insert a block of code. Can someone enlighten me?)