CodeIgniter Forums
quicker data arrays - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: quicker data arrays (/showthread.php?tid=10544)



quicker data arrays - El Forum - 08-04-2008

[eluser]cwpollock[/eluser]
Is there a quicker way to do this:
Code:
$data = array('users' => $users, 'options' => $options, 'filter' => $filter, 'page' => $page);



quicker data arrays - El Forum - 08-04-2008

[eluser]xwero[/eluser]
what do you mean by quicker?


quicker data arrays - El Forum - 08-04-2008

[eluser]sophistry[/eluser]
you mean "quicker" like this?
Code:
$data = compact('users','options','filter','page');



quicker data arrays - El Forum - 08-04-2008

[eluser]cwpollock[/eluser]
[quote author="sophistry" date="1217877035"]you mean "quicker" like this?
Code:
$data = compact('users','options','filter','page');
[/quote]

compact - perfect.. thanks, just what I was looking for!


quicker data arrays - El Forum - 08-04-2008

[eluser]johnwbaxter[/eluser]
Holy crap, there's a function i'd never heard of, that is sweet. Nice work!


quicker data arrays - El Forum - 08-04-2008

[eluser]xwero[/eluser]
[quote author="audiopleb" date="1217880136"]Holy crap, there's a function i'd never heard of, that is sweet. Nice work![/quote]
I guess there will be more functions you never heard of but are useful nonetheless. You can't remember the all, you have to be rainman to do that Wink


quicker data arrays - El Forum - 08-04-2008

[eluser]johnwbaxter[/eluser]
Generally if i've used it i'll remember it. I know there are lots of functions i don't know about, it all comes with experience though.