The problem with the array of PHP, ask for advice

// a
[1,2,3,4]
// b
["0"=>1, "1"=>2, "2"=>3, "3"=>4]

 a b php a   "" 
a  foreach   b

 a 

 a  b  json_encode() 
Php
Mar.28,2021

. Definitely different, an association, an index, in the json format display using {} [] to distinguish. Php has a function that can directly get all the values of the array, you can learn about it. Array_values


you can directly use array_values ($b) to return to the $an array;
don't worry about this problem later, it doesn't make much sense, and an is an indexed array, b is an associative array
and you correspond to an associative array in this numerical order, json_decode () is the same as the indexed array, that is, in the scenario above.


you can use array_values directly

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e40c52-4cc7c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e40c52-4cc7c.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?