As you know, Codeigniter is a great PHP framework, I'm trying to make my own framework. Here is a problem. I really like the $data
functionality in Codeigniter and I want to make it happen in my framework. Question is, how it works. Here is what it does :
you make a array like this :
$data['title']= 'My Name';
then you can use this variable like this in view :
$title ;
How I can make a variable like $data
?
What you are looking for is turning array keys into variables. There's one in-built function given to do this.
extract() - Import variables into the current symbol table from an array
$data['x'] = "Value";
extract($data, EXTR_PREFIX_SAME, null);
echo $x;
Go through docs and explore how you want to use it.