returning variable from a function
Posted: Sat Apr 23, 2005 8:43 pm
This works fine. It sends $title off to another function which displays $title the way I need.
But what I really want to do is return $title somewhere else before sending it to another function. ie I want to return $title, but I can't. I've tried several derivations of the following but it's failing to return $title every time:
Any ideas?
Simon
Jcart | Please review
Posting Code in the Forums
Code: Select all
function extract_title1($published_page)
{
if (is_array($published_page))
{
foreach ($published_page as $row)
{
$title = $row['title1'];
}
}
display_hm_title($title);
}Code: Select all
function extract_title1($published_page)
{
if (is_array($published_page))
{
foreach ($published_page as $row)
{
$title = $row['title1'];
}
}
return $title;
}Simon
Jcart | Please review