Search code examples
phpcodeignitersingletoncodeigniter-2function-pointers

PHP, Codeigniter - Singleton, What about the use of '&' in function declaration


Why it was used '&' before a function name when it was declaring the function, I never seen the use of & in declaration .

function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
Ref. Line 120, at system/core/ common.php (Version-CodeIgniter 2.2)


Solution

  • The & means the function will return a reference of a variable, instead of a value;

    http://php.net/references.return