note 99457 deleted from function.json-encode by crell
| From: | crell@php.net | Date: | Fri, 01 Jul 2022 19:17:52 +0000 |
| Subject: | note 99457 deleted from function.json-encode by crell | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-218826@lists.php.net to get a copy of this message | ||
Note Submitter: nicolas dot baptiste at gmail dot com
----
Beware of index arrays :
<?php
echo json_encode(array("test","test","test"));
echo json_encode(array(0=>"test",3=>"test",7=>"test"));
?>
Will give :
["test","test","test"]
{"0":"test","3":"test","7":"test"}
arrays are returned only if you don't define index.