KillerWolf Posted November 25, 2006 Share Posted November 25, 2006 i was wondering if anyone has a program that uses echo statements to display an ordered list and an unordered list? Link to comment https://forums.phpfreaks.com/topic/28470-echo-and-lists/ Share on other sites More sharing options...
Barand Posted November 25, 2006 Share Posted November 25, 2006 [code]<?php$data = array ('Dog', 'Cat', 'Bird', 'Fish');echo '<h3>Animals - ordered list</h3>';echo '<ol>';foreach ($data as $animal) { echo "<li>$animal</li>" ;}echo '</ol>';echo '<h3>Animals - unordered list</h3>';echo '<ul>';foreach ($data as $animal) { echo "<li>$animal</li>" ;}echo '</ul>';?>[/code] Link to comment https://forums.phpfreaks.com/topic/28470-echo-and-lists/#findComment-130276 Share on other sites More sharing options...
KillerWolf Posted November 27, 2006 Author Share Posted November 27, 2006 the unordered part of the proram does not work. possibly becuase of it being an array your pulling? Link to comment https://forums.phpfreaks.com/topic/28470-echo-and-lists/#findComment-131195 Share on other sites More sharing options...
kenrbnsn Posted November 27, 2006 Share Posted November 27, 2006 The solution works fine. Why do you say that it does not work?Ken Link to comment https://forums.phpfreaks.com/topic/28470-echo-and-lists/#findComment-131199 Share on other sites More sharing options...
KillerWolf Posted November 27, 2006 Author Share Posted November 27, 2006 just because the lists are the same and what i was needing is to be able to have it sort through the list that is allowed. Link to comment https://forums.phpfreaks.com/topic/28470-echo-and-lists/#findComment-131211 Share on other sites More sharing options...
kenrbnsn Posted November 27, 2006 Share Posted November 27, 2006 The solution answered your original question. If you can explain what you're really looking for, maybe we can help you some more.Ken Link to comment https://forums.phpfreaks.com/topic/28470-echo-and-lists/#findComment-131212 Share on other sites More sharing options...
KillerWolf Posted November 27, 2006 Author Share Posted November 27, 2006 ok sorry about that, all i need really is a to be able to enter certain lists(hard code) then have it print it albetically and then just random. sorry about my english.wolf Link to comment https://forums.phpfreaks.com/topic/28470-echo-and-lists/#findComment-131219 Share on other sites More sharing options...
Barand Posted November 28, 2006 Share Posted November 28, 2006 try[code]<?php$data = array ('Dog', 'Cat', 'Bird', 'Fish');// SORTED listsort ($data);echo '<h3>Animals - sorted list</h3>';echo '<ul>';foreach ($data as $animal) { echo "<li>$animal</li>" ;}echo '</ul>';// RANDOM listshuffle ($data);echo '<h3>Animals - random list</h3>';echo '<ul>';foreach ($data as $animal) { echo "<li>$animal</li>" ;}echo '</ul>';?>[/code] Link to comment https://forums.phpfreaks.com/topic/28470-echo-and-lists/#findComment-131240 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.