I have an array that already contains all it's values in alphabetical order:
Directory Listing:
Ahha
ah?
I just want to list the first letter each starts with above it like so:
A
___________________
Ahahhaa
Ah?
Like this
Here is code.
$alphabets = array('0-9','A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z');
$letter = list of directory.
foreach ($alphabets as $alphabet) {
if ($letter[$alphabet])
echo '<a href="#letter-'.$alphabet.'">'.$alphabet.'</a> ';
else
echo $alphabet.' ';
}
I need to print directory list according to Alphabets.
<?php
foreach ($letter[$alphabet] as $name) {
echo $name;
}
?>
$letter[$alphabet] == return nothing.
php v5.5.5