This article mainly talks about using the JSON_FORCE_OBJECT function to implement forced object transfer. Interested friends can learn about it!
1 2 3 4 |
|
Output result: [When the array subscript is a numeric index,,,,,, and is continuous]
1 2 3 |
|
Output result: {When the array subscript is a numeric index,,,,,, and there is a break in the middle of the subscript} is parsed as an object
1 2 3 4 |
|
Output result:{ Use JSON_FORCE_OBJECT to cast to object }
Summary: Except for the continuous index array, everything else is parsed as object
Related tutorials: PHP video tutorial
The above is the detailed content of PHP learning uses JSON_FORCE_OBJECT function to realize forced object transfer. For more information, please follow other related articles on the PHP Chinese website!