Jump to content

Recommended Posts

hi all,

i can't seem to figure out how to do this.

below is a bit of code that sort through an array and return the 3 highest value.

i would like to then take those three values and place them separately into the <div id> tags.

 

<?

$array = array(5, 8694, 13,5,46,84,9,48684,8642,54,3,664,87,93,24,56,487,9341,8432);

rsort($array);

for($i = 0; $i < 3; $i++) // Only loop 10 times.

echo $array[$i] . "<br>";

?>

 

<div id="container">

  <div id="left"> <?php  echo $highest?></div>

 

<div id="center"><?php  echo $secondhighest; ?></div>

 

<div id="right"><?php  echo $thirdhighest; ?></div>

</div>

 

thank you in advance for any help on this.

Link to comment
https://forums.phpfreaks.com/topic/135521-array-data-echo-into-table/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.