redarrow Posted September 30, 2008 Share Posted September 30, 2008 Advance thank u...... How can i use a loop to get the same results tried a for loop and foreach how please.......... <?php $x=array( "title1"=>"Theme Song Heroes" , "song1"=>"We happily sing your theme songs." , "name1"=> " Mythbusters" , "title2"=>"Theme Song Heroes" , "song2"=> "We happily sing your theme songs." , "name2"=>" Batman " , "title3"=>"Theme Song Heroes" , "song3"=>"We happily sing your theme songs." , "name3"=>" Power Rangers" , "title4"=>"Theme Song Heroes" , "song4"=>"We happily sing your theme songs." , "name4"=>" Dirty Jobs" , "title5"=>"Ice Cream" , "song5"=>"Plays that ice cream truck jingle." , "name5"=>" We all scream" , "title6"=>"Ice Cream" , "song6"=>"Plays that ice cream truck jingle." , "name6"=> "Ice ice cream" ); echo " Title:$x[title1] <br> Song:$x[song1] <br> Name$x[name1]<br><br> Title:$x[title2] <br> Song:$x[song2] <br> Name$x[name2]<br><br> Title:$x[title3] <br> Song:$x[song3] <br> Name$x[name3]<br><br> Title:$x[title4] <br> Song:$x[song4] <br> Name$x[name4]<br><br> Title:$x[title5] <br> Song:$x[song5] <br> name:$x[name5]<br><br> Title:$x[title6] <br> Song:$x[song6] <br> Name:$x[name6]<br><br>"; ?> Link to comment https://forums.phpfreaks.com/topic/126404-solved-how-to-loop-this-method-thank-u/ Share on other sites More sharing options...
redarrow Posted September 30, 2008 Author Share Posted September 30, 2008 SOLVED MY SELF <?php $x=array( "title1"=>"Theme Song Heroes" , "song1"=>"We happily sing your theme songs." , "name1"=> " Mythbusters" , "title2"=>"Theme Song Heroes" , "song2"=> "We happily sing your theme songs." , "name2"=>" Batman " , "title3"=>"Theme Song Heroes" , "song3"=>"We happily sing your theme songs." , "name3"=>" Power Rangers" , "title4"=>"Theme Song Heroes" , "song4"=>"We happily sing your theme songs." , "name4"=>" Dirty Jobs" , "title5"=>"Ice Cream" , "song5"=>"Plays that ice cream truck jingle." , "name5"=>" We all scream" , "title6"=>"Ice Cream" , "song6"=>"Plays that ice cream truck jingle." , "name6"=> "Ice ice cream" ); for($i=1; $i<7; $i++){ $title=$x[title.$i]; $song=$x[song.$i]; $name=$x[name.$i]; echo " Title:$title <br> Song:$song <br> Name:$name<br><br>"; } ?> Link to comment https://forums.phpfreaks.com/topic/126404-solved-how-to-loop-this-method-thank-u/#findComment-653647 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.