I am absolutely baffled.
I have some code that works perfectly in Development. The moment I posted it to Production I get an error
Parse error: syntax error, unexpected ‘[’ in /usr/local/apache/vhosts/secure.my-911.com/html/reports/Event_Manager/Event_Manager_grid.class.php on line 2812
I have checked line 2812 and nothing seems to be out of the norm.
I thought maybe it has to do with my libraries so when I posted to production I made sure I included these, and updated.
But still no joy.
Below is the code. It’s task is to convert TimeZones with an Error Routine. I have made the where the line of code 2812 points to BOLD. (strange though that it works in Development)
$timezone=[timezone];
$dt={updated_timestamp}; // ‘2014-11-25 18:32:19’;
$tz1=‘UTC’;
$df1=‘Y-m-d H:i:s’;
$tz2=$timezone; // ‘Africa/Johannesburg’;
$df2=‘d/m/Y H:i:s’;
//function date_convert($dt, $tz1, $df1, $tz2, $df2) {
$res = ‘’;
if(!in_array($tz1, timezone_identifiers_list())) { // check source timezone
trigger_error(FUNCTION . ': Invalid source timezone ’ . $tz1, E_USER_ERROR);
} elseif(!in_array($tz2, timezone_identifiers_list())) { // check destination timezone
trigger_error(FUNCTION . ': Invalid destination timezone ’ . $tz2, E_USER_ERROR);
} else {
// create DateTime object
$d = DateTime::createFromFormat($df1, $dt, new DateTimeZone($tz1));
// check source datetime
if($d && DateTime::getLastErrors()[“warning_count”] == 0 && DateTime::getLastErrors()[“error_count”] == 0) {
// convert timezone
$d->setTimeZone(new DateTimeZone($tz2));
// convert dateformat
$res = $d->format($df2);
} else {
trigger_error(FUNCTION . ': Invalid source datetime ’ . $dt . ', ’ . $df1, E_USER_ERROR);
}
}
{localdate}=$res;