Jump to content

[SOLVED] Grabbing a variable out of an array??


JREAM

Recommended Posts

THis is a weird question I am trying to sort out.

 

I got this that makes an array right,

But i want to sort the output before its printed:

 

I need the variable so I can sort($position) for the output

foreach ($output as $value) {

// How do I grab the $position from 
// $output[$i] so I can $sort($position)
echo $value;
}

 

(I just removed stuff to make it shorter, it works)

while (//etc..) {
// Removed stuff here to make it shorter
$output[$i] = "<tr>
<td style='padding: 5px;'>$position</td>
<td style='padding: 5px;'>$title</td>
</tr>";
}

 

 

 

PS: How do i mark something as solved ??

EDIT: Umm beaten to it

Sort the array before the foreach loop, eg

 

asort($output);

foreach ($output as $value) {
    // How do I grab the $position from 
    // $output[$i] so I can $sort($position)
   echo $value;
}

 

PS: How do i mark something as solved ??

You should see a TOPIC SOLVED link just above the Quick reply box.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.