Re: [PHP-DEV] [RFC] [Discussion] Operator functions

This is only part of a thread. view whole thread
  100476
September 8, 2017 22:45 ocramius@gmail.com (Marco Pivetta)
On Fri, Sep 8, 2017 at 11:41 PM, Andrea Faulds <ajf@ajf.me> wrote:

> Hi everyone! > > Here's an RFC for a small, simple, self-contained feature with no > backwards-compatibility breaks and which in fact doesn't even touch the > language's syntax (it's 50%+1 eligible!) but which could make PHP a bit > more expressive and consistent, especially with potential later features. > It even has a test designed to impose minimal maintenance burden while > testing a fairly large possibility space! > > Anyway, the RFC in question is this: https://wiki.php.net/rfc/opera > tor_functions > > Please tell me what you think and suggest any potential improvements or > anything you think might have been an omission. > > Thanks! > -- >
This is bloody brilliant! Stupid example, but: function factorial(int $i) { return array_reduce(range(1, $i), "*", 1); } I see great potential in this: moving away from operators as weird syntactic sugar and in the direction of operators as functions (what they actually are). Marco Pivetta http://twitter.com/Ocramius http://ocramius.github.com/