class TData
{
var $image = "";
var $title = "";
var $pos = ""
}
function getTData(){
$tos = 99;
foreach($arList as $entry)
{
$output = new TData();
$output->image = $imagename;
$output->title = $title;
$output->pos = $tos;
$tempArr[] = $output;
$tos++;
}
return $tempArr;
}
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();
$f = getTData();
foreach ( $f as $k => &$v )
{
$output = "";
$output .= "<td><span id=\"name".$v['pos']."\">".$v['title']."</span></td>";
}
array_push($ar1, $output);