Re: Re: [PHP6] Function name consistency

From: Date: Wed, 29 Jan 2014 19:04:05 +0000
Subject: Re: Re: [PHP6] Function name consistency
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-71742@lists.php.net to get a copy of this message
On Wed, Jan 29, 2014 at 7:21 PM, Stas Malyshev <smalyshev@sugarcrm.com>wrote: > Hi! > > > Compare: $str = str_replace('-', '_', > > $str); > > > > To: $str = $str->replace('-', > > '_'); > > > > Or: $keys = array_keys($array); > > > > To: $keys = $array->keys(); > > > > 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. > https://github.com/nikic/scalar_objects Also, the point of doing this is not the nicer syntax, but the opportunity to improve the APIs in a reasonable fashion (no countless aliases). Nikita

« previous php.internals (#71742) next »