Thursday, 15 April 2010

Output PHP array into unordered list -



Output PHP array into unordered list -

new php: have simple array:

$people = array('joe','jane','mike');

how output list?

<ul> <li>joe</li> <li>jane</li> <li>mike</li> </ul>

any help or direction appreciated?

try:

echo '<ul>'; foreach($people $p){ echo '<li>'.$p.'</li>'; } echo '</ul>';

php

No comments:

Post a Comment