I have this basic function getdetails()
, I simplified the code that way its easy to understand what I need. I would like to be able to echo (or use) the value of title
or lname
outside of the function getdetails
. Any help would be greatly appreciated
function getdetails ($var){
$title = "Hello World";
$lname = "John Doe";
switch ($var)
{
case "title":return $title; break;
case "lastname":return $lname; break;
}
}
echo "title is: ".$title;