Need load parameters to function, creating a variable name on the fly terrible thing, but I do not see another solution. This code contains an error please help
<?php
class A{
public $vars;
public $tab_names;
public $tab_names = array('car'=>'audi', 'honda' => 'name');
public $tab_fruits = array('name'=>'banana', 'banana'=>'fruit');
public function load($varr){
$$varr;
$this->vars = $varr;
}
public function display(){
return $this->vars;
}
}
$ob = new A;
$ob->load('tab_names');
$ob->display();
?>
Like this?