Created
August 25, 2023 11:17
-
-
Save gmailzj/40a458186a352423c61f405403a68f9b to your computer and use it in GitHub Desktop.
php json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $arr = []; | |
| $arr[1] = 'yyy'; | |
| $arr[0] = 'xxx'; | |
| echo json_encode($arr);//{"1":"yyy","0":"xxx"} | |
| $arr = []; | |
| $arr[0] = 'xxx'; | |
| $arr[1] = 'yyy'; | |
| echo json_encode($arr);//["xxx","yyy"] | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment