I guess that the biggest problem is about the code parsing. Currently PHP should supports what you wrote, but with another meaning. And personally I think that this feature is not too common on programming language in general, once that it is possible from first format (maybe more clear too).
Em 6 de nov de 2016 6:30 PM, "Fleshgrinder" <p...@fleshgrinder.com> escreveu: > Validating whether a number is within a closed or open interval is > currently possible only via a construct like the following: > > ``` > if (0 < $x && $x < 42) { > echo 'x is in (0, 42)'; > } > > if (0 <= $x && $x <= 42) { > echo 'x is in [0, 42]'; > } > ``` > > It is not very readable and repetitive. It would be interesting to > support a more mathematical notation for this: > > ``` > if (0 < $x < 42) { > echo 'x is in (0, 42)'; > } > > if (0 <= $x <= 42) { > echo 'x is in [0, 42]'; > } > ``` > > I cannot judge how complicated it is to extend the Bison definitions to > allow this. However, if there is interest I'm sure there is a way. :) > > -- > Richard "Fleshgrinder" Fussenegger > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >