Welcome Guest, Not a member yet? Register   Sign In
Generating variables from associative array
#1

[eluser]Unknown[/eluser]
Hi,

I'm new to CodeIgniter and while browsing through user guide I found a function which could generate variables from associative array, e.g.

Code:
// this
$arr = array('var1' => 'value1', 'var2' => 'value2')

// will produce two variables $var1 and $var2 with their corresponding values

However, unfortunately I forgot the function name and the section where I read it and now I'm not able to find it again! Silly, I know but I have spent considerable time now searching for it. Please Help!
#2

[eluser]jedd[/eluser]
Perhaps you mean the standard PHP [url="http://uk2.php.net/extract"]extract[/url] function?

CI's [url="http://ellislab.com/codeigniter/user-guide/libraries/loader.html"]load_vars()[/url] uses this, I think, for when you're sending arrays full of data into views.
#3

[eluser]Unknown[/eluser]
Yeah, thanks! Thats exactly what I wanted.




Theme © iAndrew 2016 - Forum software by © MyBB