I'm trying to make a list of directories from a file. But I only want the list to contain unique entries i.e. - only echo once no duplicates.
Example: From this log file:
inactive : [2007-04-01 08:42:21] "home/club/member" 210.00 "r-200"
inactive : [2008-08-01 05:02:20] "home/club/staff" 25.00 "r-200"
active : [2010-08-11 10:12:20] "home/club/member" 210.00 "r-500"
inactive : [2010-01-02 11:12:33] "home/premier/member" 250.00 "r-200"
active : [2013-03-04 10:02:30] "home/premier/member" 250.00 "r-800"
active : [2011-09-14 15:02:55] "home/premier/member" 250.00 "r-100"
I want to echo the list of directories but no duplicates:
home/club/staff
home/club/member
home/premier/member
I used a foreach loop to iterate through the array but I don't know how to compare each value to each item in the array and then only output identical items once.
foreach($listofDir as $value)
{
echo "<p>" . $value . "</p>";
}