I get some JSON response from one server url. Response options may vary based on user credentials,
For example, sometimes it will return the state of the user, sometimes this client state has the same value, but I need to handle it as if some state parameter did not arrive by default, empty, so I tried the following logic.
$centre_jurisdiction = $data['data']['ctj'] ?? "";
$state_jurisdiction = $data['data']['stj'] ?? "";
The above logic works fine in my local host, but it doesn’t work on my live server, then I found the reason, it doesn’t work on my live server, because my version of PHP for PHP on the server is 5.0, and it works in my local host because my localhost is PHP version 7.0.
I need this logic to work on my live server without updating my version of PHP to PHP, because some old projects were also hosted on this server and they will be supported on PHP 5.
Is there an alternative to handling this logic? Thank!
source
share