Code: Select all
<?php
$ini = parse_ini_file('letsplay.ini',true);
asort($ini);
$cur_num = 1;
while($cur_num <= count($ini))
{
//This should look in the first entry and return the url, name, and author. Instead, it goes "by" for about 693 lines.
echo('<a href="' . $ini[$cur_num]['url'] . '">' . $ini[$cur_num]['name'] . ' by ' . $ini[$cur_num]['author'] . '</a><br>');
$cur_num += 1;
}?>My results.
I'm having a hard time figuring out how to do this. What I'm trying to do is take an .ini file and display things from it after it's been alphabetized (this also has the nice side effect of removing duplicate entries). I want to access the 'name', 'author', and 'url' keys' values for the nth array, but it's not working. From the documentation I've look at, I assume that PHP doesn't understand that I want to read the nth thing in the list, but instead thinks that I'm looking for n in the list. If I could convert the first part of the multidimensional array to a number after sorting, I'd be set; unfortunately, I haven't got a clue as to how I would go about that. Can anyone help?
P.S. Why does PHP use a period for concatenation rather than a plus?