Welcome Guest, Not a member yet? Register   Sign In
why pass reference to Codeigniter super object instead of copying it?
#1

[eluser]MikeW1911[/eluser]
According the documentation, to use the native Codeigniter resources in a custom class I should pass a reference to the Codeigniter super object like so:

Code:
$CI =& get_instance();

My custom library seems to work by copying the super object instead of passing a reference. Is it simply more efficient to pass a reference to the CI super object rather than making a copy or are there other reasons to pass a reference to the super object?
#2

[eluser]CroNiX[/eluser]
Passing by reference allow you to access everything thats already loaded by CI. If you make a copy, you are copying everything that's loaded consuming 2x the resources.




Theme © iAndrew 2016 - Forum software by © MyBB