syntax error in example script - parent-child editing

syntax error in example script - parent-child editing

srlappsrlapp Posts: 1Questions: 1Answers: 0

The example script for the server-side (PHP) script - user.php includes a code line echo json_encode( [ "data" => [] ] ); which is reflected as a syntax error when I replicate this line in a program. I'm at a loss as to how to correct the syntax error. This was an example script posted on the Editor site on Friday, 25 March 2016. Thanks

Answers

  • allanallan Posts: 63,482Questions: 1Answers: 10,467 Site admin

    Sounds like you are using PHP 5.3 or older. The short syntax for arrays was introduced in 5.4. The old style of doing it would be:

    json_encode( array( "data" => array() ) ); 
    

    Support for PHP (by the PHP team) was discontinued in 2014. It would be worth updating if you are using a legacy version.

    Allan

This discussion has been closed.