user2881809
user2881809

Reputation:

Notice: Use of undefined constant JSON_HEX_TAG - assumed 'JSON_HEX_TAG'

Good day.

$arr = array(1, "Hello");
json_encode($arr, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP);

when i use code i get notice:

Notice: Use of undefined constant JSON_HEX_TAG - assumed 'JSON_HEX_TAG' in ....

Notice: Use of undefined constant JSON_HEX_APOS - assumed 'JSON_HEX_APOS' in ....

Notice: Use of undefined constant JSON_HEX_QUOT - assumed 'JSON_HEX_QUOT' in ....

Notice: Use of undefined constant JSON_HEX_AMP - assumed 'JSON_HEX_AMP' in ....

Warning: json_encode() expects exactly 1 parameter, 2 given in ....

Anyone know why i get it notice?

Upvotes: 1

Views: 2706

Answers (1)

user1864610
user1864610

Reputation:

You're using a version of PHP earlier than 5.3. Those constants are only available in PHP 5.3+

Upvotes: 4

Related Questions