Help about get_instance() function |
Greetings everyone,
I have a simple little question and I appreciate it if you help me understand if what I have in mind is useful or not. Consider this CodeIgntier function: PHP Code: function &get_instance() Is is really good practice and useful if I change it (if allowed) to this: PHP Code: function &get_instance() This is just an idea I had i mind and I was wondering if it is really useful. Thanks in advance.
Follow me on Github, you may find interesting things!
The $instance variable is already static inside CI_Controller. I think your suggestion might actually add a method call to the functionality, however marginal the execution time difference would be.
(05-12-2018, 05:08 PM)ciadmin Wrote: The $instance variable is already static inside CI_Controller. I think your suggestion might actually add a method call to the functionality, however marginal the execution time difference would be. It's not a suggestion, I just had that in mind and wanted to make it clear because I was confused whether it is good practice or not. If I understand your answser, the execution time might be better, even slightly, that's a good thing right? Thanks a lot for your answer.
Follow me on Github, you may find interesting things!
Er, the execution time might be worse using your approach, although only slightly.
05-12-2018, 07:23 PM
(This post was last modified: 05-12-2018, 07:26 PM by bkader. Edit Reason: Fixed smiley. ) (05-12-2018, 06:44 PM)ciadmin Wrote: Er, the execution time might be worse using your approach, although only slightly. Oh I see! I understood the opposite! Thanks a lot. EDITED: I tested it, you were right, I got like +0.01xx in execution time
Follow me on Github, you may find interesting things!
|
Welcome Guest, Not a member yet? Register Sign In |