1

In order to provide the second parameter for the PHP function json_encode "options" I use a predefined variable

public $jsonParameters = JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE;

and call it later with

json_encode($result, $this->jsonParameters);

This worked all the time but now on one customer server it leads to the following error message:

Parse error: syntax error, unexpected '|', expecting ',' or ';' in

Is this not a correct way to use the pipe character? But how did it work everywhere else?

alobeejay
  • 247
  • 3
  • 12
  • My first impression is, that you use the bitwise OR operator correctly. – Philipp Maurer Jan 22 '18 at 12:09
  • 1
    Sounds like your customer uses an ancient PHP version, and you need to become aware of version incompatibilities and set some minimum supported version. – deceze Jan 22 '18 at 12:09
  • You can use expressions in PHP 5.6 and newer. Probably, customer server has too outdated PHP version (5.3, for example) – Gino Pane Jan 22 '18 at 12:13

0 Answers0