We just migrated from PHP 5.6 to PHP 7 and we ran into an issue with the strtotime()
method
The applications calculates the localtime from a UTC time to do this we used the following code
$timezone = " UTC+0100";
$localTime = date("Y-m-d H:i:s", strtotime("now".$timezone));
which would output the local time
So i tested it locally
<?php
echo date("Y-m-d H:i:s", strtotime("now"));
echo PHP_EOL;
echo date("Y-m-d H:i:s", strtotime("now UTC+0100"));
?>
And the result in PHP 5.6 is 2017-01-20 09:13:49 2017-01-20 10:13:49
And the result in PHP 7 is 2017-01-20 09:13:49 2017-01-20 09:13:49
Is there some thing I'm doing wrong or did something change in the syntax for PHP 7?
I know the best way is could do this is to use the DateTime class from PHP and i will implement it in the long term but for now i'm looking for a quick solution