PDA

View Full Version : print_r() question


Logikos
08-06-2005, 04:55 PM
print "<pre>";
print_r($rss_array);
print "</pre>";


The output of that is;

Array
(
[items] => Array
(
[0] => Array
(
[title] => Users online gets messed up with weird names
[link] => http://www.vbulletin.com/forum/bugs35.php?do=view&bugid=907
[description] => Type: Unknown/General
Status: Confirmed
Last Post By: Freddie Bingham
)

[1] => Array
(
[title] => tag bug
[link] => http://www.vbulletin.com/forum/bugs35.php?do=view&bugid=917
[description] => Type: Unknown/General
Status: Confirmed
Last Post By: ShytK
)

)

[channel] => Array
(
[title] => vBulletin 3.5 Bug Tracker
)

)


Now what variable holds the information to show the title and description? I've read the PHP manual and they say;


$b = array ('m' => 'monkey', 'foo' => 'bar', 'x' => array ('x', 'y', 'z'));
$results = print_r($b, true); //$results now contains output from print_r


But I don't quite get it. Any help? Thanks!

Andreas
08-06-2005, 04:58 PM
foreach ($rss_array['items'] AS $item)
{
echo "Title: $item[title], Description: $item[description]<br />";
}

Logikos
08-06-2005, 05:09 PM
* Logikos bows down to Kirby :)

Thank you my friend.

filburt1
08-06-2005, 10:18 PM
From the snippet you posted, the manual likely is suggesting output buffering through the functions ob_start(), ob_get_contents(), and ob_end_clean().