ironman32 Posted April 10, 2009 Share Posted April 10, 2009 I have a number of array lists that use the rand runction so that the elements come out at random. Here is my code <?php srand((float) microtime() * 10000000); $input = array("<a href= \http://www.muscleandstrength.com/exercises/good-mornings.html\ >Good mornings</a>", "<a href= \http://www.muscleandstrength.com/exercises/seated-good-mornings.html\>Seated good mornings</a>", "<a href= \http://www.muscleandstrength.com/exercises/deadlifts.html\> Deadlift</a>"); $rand_keys = array_rand($input); //echo $input[$rand_keys[1]] . "\n"; $input1 = array("<a href= \http://www.muscleandstrength.com/exercises/squat.html\>Squat</a>", "<a href= \http://www.muscleandstrength.com/exercises/dumbbell-squat.html\>Dumbell squat</a>", "<a href= \http://www.muscleandstrength.com/exercises/smith-machine-squat.html\>Smith Machine Squat</a>"); $rand_keys = array_rand($input1, 2); $input2 = array("<a href= \http://www.muscleandstrength.com/exercises/45-degree-leg-press.html\>45 degree leg press</a>", "<a href= \http://www.muscleandstrength.com/exercises/one-leg-45-degree-leg-press.html\>One leg 45 degree leg press</a>", "<a href= \http://www.muscleandstrength.com/exercises/dumbbell-lunge.html\>Dumbell lunge</a>"); $rand_keys = array_rand($input2, 2); $input3 = array("<a href= \http://www.muscleandstrength.com/exercises/seated-calf-raise.html\>Seated calf raise</a>", "<a href= \http://www.muscleandstrength.com/exercises/45-degress-calf-press.html\>45 degree toe raise</a>", "<a href= \http://www.muscleandstrength.com/exercises/seated-dumbbell-calf-raise.html>Seated dumbell calf raise</a>"); $rand_keys = array_rand($input3, 2); ?> What I am trying to do is output an element from each array into an ordered list e.g. 1.Good mornings 2.Squat 3.45 degree leg press Can anyone offer any help on this? Link to comment https://forums.phpfreaks.com/topic/153522-array-elements-into-one-ordered-list/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.