note 110831 deleted from function.array-values by philip
| From: | philip@php.net | Date: | Fri, 14 Dec 2012 06:52:04 +0000 |
| Subject: | note 110831 deleted from function.array-values by philip | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-192526@lists.php.net to get a copy of this message | ||
Note Submitter: garcia at online dot nl
----
If you are looking for a simple and hardcoded script to extract a single value of an array in
ascending order, try this :
<?php
$a=scandir('mp3');
$total = count($a);
$i=2;
do
{
echo "Artiest = ";
echo $a[$i]. "<br />";
$i=$i+1;
}
while ($i<=$total-1);
?>
remark : the variable $i is set so that the first 2 entries of the array are skipped. These entries
contains the values "." and ".."
These values represent the root and the mp3 directories themselves and therefor most likely not
wanted for use in your script. However, you can change it to any number you like as long as its
value ddoesn´t not exceeds the total number of records in the array. Play with it and you´ll
quickly understand this.