Hello,
I just wanted a quick explanation of this line of code used in a php class for database connection.
register_shutdown_function(array(&$this, 'close'));
I understand that this function is to execute when script processing is complete. But, the format is designated as such:
void register_shutdown_function ( callback function [, mixed parameter [, mixed ...]])
I'm confused about this part of the code inparticular: array(&$this, 'close') It doesn't look like the function is suppose to take an array in, and, I'm not sure why creating an array works here. I think I'm just missing the picture entirely, but I've seen this code used several places, and, I'm just wondering what is really going on here.
I'm also confused on what the REFERENCE being created is to (the & symbol). It's a reference to $this, which I assume is the instance of the class. But, why doesn't this work:
register_shutdown_function('close');
I'm confused on the reference, and the array. Could someone exlpain this in some detail?
Thanks!