I have a problem I have two arrays, 1 created using php explode function. What I want is to display the number for each word in the array. Below is the code I'm using. The reason I want it so that I can link a mp3 file to each word in the list. The file link format to the mp3 are link this: 0000001.mp3, 0000002.mp3, etc.
Currently the arrays are producing starting key values of zero for every array:
$a1=array(0=>"Cat",1=>"Dog",2=>"Horse",3=>"House");
$a2=array(0=>"Bird",1=>"Rat",2=>"Fish");
$a3=array(0=>"Horse",1=>"Dog",2=>"Bird");
I want the arrays to have keys that continue so that I can link them to a mp3 file e.g
$a1=array(0=>"Cat",1=>"Dog",2=>"Horse",3=>"House");
$a2=array(4=>"Bird",5=>"Rat",6=>"Fish");
$a3=array(7=>"Horse",8=>"Dog",9=>"Bird");
check line 15 p.s I am not a pro at php and I definitely know there are a couple of mistakes in the php code. http://www.deen-ul-islam.org/quran-player/quran.php
foreach ($suraText as $aya) {
$trans = $transText[$ayaNum- 1];
// remove bismillahs, except for suras 1 and 9
if (!$showBismillah && $ayaNum == 1 && $sura !=1 && $sura !=9) {
$aya = preg_replace('/^(([^ ]+ ){4})/u', '', $aya);
// display waqf marks in different style
// $aya = preg_replace('/ ([ۖ-۩])/u', '<span class="sign"> $1</span>', $aya);
$surah2 = leading_zeros($sura, 3);
$ayaNum2 = leading_zeros($ayaNum, 3);
$aya = explode(' ',$aya);
echo "<div class=aya>";
echo "<div class=quran><a href='http://www.everyayah.com/data/Ghamadi_40kbps/$surah2$ayaNum2.mp3' class='sm2_link'><span class=ayaNum>$ayaNum. </span></a>";
foreach($aya as $key => $aya) {
$key = $key+1; ?>
<a href="http://audio.allahsquran.com/wbw/<?php echo $key ?>.mp3" class="sm2_link"><span class="word"><?php echo $aya ?></span></a>
<?php }
echo "</div>";
//echo "<div class=trans>$trans </div>";
echo "</div>";
$ayaNum++;
}
keyas num, so yourkeyis thevalue?