joelcox / codeigniter-redis

A CodeIgniter library to interact with Redis
MIT License
240 stars 142 forks source link

get_instance() function assigned by reference #54

Closed twn39 closed 4 years ago

twn39 commented 10 years ago

This change is Reviewable

joelcox commented 10 years ago

Hi Tang, thanks for your pull request!

In PHP 5 objects are passed by reference by default, so I don't really see why the & would be necessarily. Could you elaborate? Thanks!

twn39 commented 10 years ago

Because codeigniter manual are described, and marked: very important, maybe I need to take a closer look php5 principle。

joelcox commented 10 years ago

You are right, this used to be important in the PHP 4 days, but doesn't really apply to PHP 5. See this SO question.

danhunsaker commented 9 years ago

CodeIgniter requires it because it's designed for the broadest compatibility with PHP versions actually in use. PHP 4 has been replaced on all but the most forgotten or niche of systems (or those run by the least competent sysadmins, but I digress), so CI's minimum supported version is up to 5.2 (which, stupidly, is still widely deployed) - which means we no longer need the &. Though it can still be useful as a reminder in some places that the return value we're expecting will be by reference, that probably won't help much here.