arrays - PHP Parse ini file -
i wrote program skim log files , pass information ini file , i'm trying php work it, i have 0 experience php.
i have ini file contains information so,
[76561197962467705] username = ".buckism" suicide = 0 bear.prefab = 0 killed fall = 0 patrolhelicopter.prefab = 0 wolf.prefab = 0 cold = 0 explosion = 0 barricade = 0 player deaths = 0 total deaths = 0 kills = 2
i use php ini parser , can ini print webpage.
$ini_array = parse_ini_file("myfile.ini", true); print_r($ini_array);
the printed array. http://liveviewtest.byethost7.com/index.php
from have read parse_ini_file parses information multidimensional array if true flag set. why cant access array elements using brackets?
echo $ini_array[0][0];
because got dictionary, non ordered array. can't address each element of structure numeric index, since indexed keys defined in ini file. address
$ini_array['76561197988912576']['username']
you can cycle foreach loop
foreach($ini_array $key=>$value) { echo ($value['username']); }
or can convert dictionary indexed array "array_keys"
$ini_array = array_keys($ini_array); echo $ini_array[0]['username'];
Comments
Post a Comment