On Wed, Jan 29, 2014 at 7:21 PM, Stas Malyshev <[email protected]>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