All pastes #30100 Raw Edit

Stretsh

public text v1 · immutable
#30100 ·published 2005-11-21 21:44 UTC
rendered paste body
	Array
(
    [0] => tdata Object
        (
            [image] => image1.gif
            [title] => file1
            [pos] => 99
        )

    [1] => tdata Object
        (
            [image] => image2.gif
            [title] => file2
            [pos] => 100
        )

    [2] => tdata Object
        (
            [image] => image3.gif
            [title] => file3
            [pos] => 0
        )
)

So what I'm wanting to do is loop through this array with a for each and use the variables under each object to fill in the blanks for a dynamic table thats being created and put into another array.

I also need it to grab the object with the lowest pos => number first so that it is in front of the new ar1 array so as to sort it by the pos value.

Sorta like this that I know isn't complete:

$ar1 = array();

$arlist = getTData();
foreach($arList as $entry)
{
	$output = "";
        $output .= "<td><span id=\"name".$tdata[0]->pos."\">".$tdata[0]->title."</span></td>";

}
array_push($ar1, $output);