This is totally bewildering for me as I've never experienced such a thing before. My localhost environment is 5.6.7 PHP and my production server (shared hosting) is currently running 5.3.29 and it seems that this inline script is causing problems in the production environment but runs without any errors, notices or even warnings on my local.
<?php
$account_record['User']['date_of_birth'] = '';
$request_data['User']['dob_data'] = '';
$dob_date = (!empty($account_record['User']['date_of_birth'])?explode('-',$account_record['User']['date_of_birth'])[2]:(!empty($request_data['User']['dob_date'])?$request_data['User']['dob_date']:''));
This is error I get on PHP 5.3.29
Parse error: syntax error, unexpected '[' in [...][...] on line 5
I can't seem to figure out what is wrong. I've put a sandbox link below and I was able to replicate the problem there. If I select 5.3.29 it doesn't work, but when I select say It starts working PHP 5.4, it works. http://sandbox.onlinephpfunctions.com/code/96decf9191975c9948d346d183f6d443f0beeeaf
Any help would be appreciated. Thanks.