I have a class that for the sake of example to make it easier to understand, takes an associative array, loops over it and assigns a variable name, based on key, and assigns it the value. This works fine in the class:
class showItems {
static public function list(){
foreach ($list as $name => $value) {
$$name = $value;
}
// This works here
echo $title; // This is the variable I want Which is being set in the foreach.
break;
}
}
The above class works fine, and $title can be echo'd. However, accessing that variable from outside of the class is where I don't have any luck. I've tried all types of processes I can think of.
$showItems = new showItems();
$showItems::list();
// Cannot grasp what I need to do here to echo the value I want.
$showItems::list()->$title; // This returns "Trying to get property of non-object"
?>
showItemsreturn?