Re: Re: [PHP6] Function name consistency
| From: | Lester Caine | Date: | Wed, 29 Jan 2014 19:01:45 +0000 |
| Subject: | Re: Re: [PHP6] Function name consistency | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-71740@lists.php.net to get a copy of this message | ||
Stas Malyshev wrote:
Compare:$str = str_replace('-', '_', $str);To:$str = $str->replace('-', '_');
I think it looks a lot cleaner, self-explaining, shorter, and if you are used to write OOP, it fits better to the rest of your code.
I think it has very little difference and entirely a matter of personal taste. But the thing is - nobody prevents anybody from writing an extension that does string ops or array ops as an object. Yet it did not happen in last 10 years, AFAIK.Isn't this just a mater of the increased overheads demanded by defining $str as a 'string object' over just a simple 'string'. It amasses me at times just how big some of the objects created are simply to handle what is essentially just a simple array of strings and the like. Just what overhead is being created and how much faster would things work if we returned to a less 'object based' structure? The majority of the processing I'm doing would be much faster if the database simply returned an array of variables ... -- Lester Caine - G8HFL ----------------------------- Contact - http://lsces.co.uk/wiki/?page=contact L.S.Caine Electronic Services - http://lsces.co.uk EnquirySolve - http://enquirysolve.com/ Model Engineers Digital Workshop - http://medw.co.uk Rainbow Digital Media - http://rainbowdigitalmedia.co.uk