-2

Am running PHP Version 5.2.17 i got this error on below code

        // member information
        $json = json_encode([
            'email_address' => $email,
            'status'        => '',
        ]);

Am stuck don't know what wrong with my code, any help is appreciated

chris85
  • 23,846
  • 7
  • 34
  • 51

2 Answers2

0

You cant use short array syntax [] in PHP < 5.4

So you have to do it the old way array( )

http://php.net/manual/en/migration54.new-features.php

For your specific case just change it to this

    $json = json_encode(array(
        'email_address' => $email,
        'status'        => '',
    ));
ArtisticPhoenix
  • 21,464
  • 2
  • 24
  • 38
0

I think your syntax is not valid anymore. Try this:

$arr = array('email_address' => $email, 'status' => '');
$json = json_encode($arr);
chris85
  • 23,846
  • 7
  • 34
  • 51
Stefan Dacey
  • 165
  • 12