How to convert the key index of an array into a digital index?
For example, the information I read from the INI file is a one-dimensional array:
This is my INI file
[web]
host = localhost
Connuser = root
Connpwd = root
CONNDB = Myoffice
PHP Code
Read file function readconfig ($filename) { if (file_exists ($filename) = = False) { //echo "
Files ". $filename." does not exist!
"; return NULL; } Return Parse_ini_file ($filename, True); } Test $Setting = Array (); $res = Array (); $Setting = Readconfig ("Webconfig.ini"); Print_r ($Setting);
I don't want this array with a key, because I'm not used to it, I hope I can turn it into this--using the array number subscript index number 0,1,2,3,。。。
$res [0] = = localhost;
$res [1] = = root;
...
Instead of $setting[the form "host"] = = localhost?
------Solution--------------------
Array_values ();
------Solution--------------------
You have
Return Parse_ini_file ($filename, true);
So the returned array is a two-dimensional array
PHP Code
Array ( [web] = = Array ( [host] + localhost [connuser] + root [connpwd] = root [ CONNDB] = Myoffice ))