All pastes #30197 Raw Edit

Unnamed

public text v1 · immutable
#30197 ·published 2005-11-22 02:58 UTC
rendered paste body
         Array
(
    [0] => tdata Object
        (
            [image] => image1.gif
            [title] => file1
        )

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

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


<?php

$ar1 = array();

$f = getTData();// this function returns the array above

foreach ( $f as $k => $v )
{
	$output = "";
        $output .= "<td><span id=\"name".$v['pos']."\">".$v['title']."</span></td>";

        array_push($ar1, $output);
}
?>

This doesn't work.  $v['title'] is returning nothing for me.

Also tried the foreach as:

foreach ($f as $v)

With the same result.

var_dump($v); in the foreach ($f as $v) gives me:

object(tdata)(2) {
  ["image"]=>
  string(10) "image1.gif"
  ["title"]=>
  string(5) "file1"
object(tdata)(2) {
  ["image"]=>
  string(10) "image2.gif"
  ["title"]=>
  string(5) "file2"
object(tdata)(2) {
  ["image"]=>
  string(10) "image3.gif"
  ["title"]=>
  string(5) "file3"