Ok, so I'm doing a project for school and I'm lost! I have to open a php directory into an array, and then have is displayed into a table and in alphabetical order. This is the code I have for my array so far:
<?php
$lines = file('telephonedirectory.txt');
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
}
?>
That opens it into an array and displays the directory just fine, but I need help with making just the last name, first name, and phone number show up instead of everything, and I don't know how. I also don't know how to get it in alphabetical order and make it show up in a table, it's confusing me.
I think I am supposed to explode it somewhere, but I have no idea how. :/
I don't want anyone to do my homework for me, I just need some direction and help. I'm trying my best and have spent at least 20 hours on it, it's already late and I really need to know what I'm doing wrong.
<?php
$lines = file('telephonedirectory.txt');
foreach ($lines as $line_num => $line) {
echo "Line #<b>{$line_num}</b> : " . htmlspecialchars($line) . "<br />\n";
}
?>
That opens it into an array and displays the directory just fine, but I need help with making just the last name, first name, and phone number show up instead of everything, and I don't know how. I also don't know how to get it in alphabetical order and make it show up in a table, it's confusing me.
I think I am supposed to explode it somewhere, but I have no idea how. :/
I don't want anyone to do my homework for me, I just need some direction and help. I'm trying my best and have spent at least 20 hours on it, it's already late and I really need to know what I'm doing wrong.