I've googled a bit now, but can't find anything that works for me.
I have a textfile containing: username;firstname;lastname;classcode\n
I use this while-loop to get content out:
$handle = fopen("studen.txt", "r");
while(!feof($handle)) {
$linje = fgets($handle);
$larray = explode(";",$linje);
$klassekode = trim($larray[3]);
}
$larray[3] is the only thing I'm interested in here. I want to make a html-list out of this, so I used:
echo "<option value=\"$klassekode\">$klassekode</option>";
My problem now is that I can't seem to find a way to remove the duplicate entries. There are now 3 "IS1", 4 "IS3" and so on. I suspect there's a easy solution for this that I simply can't figure out :-|
Thanks in advance!
$larray[2]
as the result fromexplode()
will be zero-based? – Sepster Oct 3 '12 at 14:40