On Fri, Feb 7, 2025, at 4:54 PM, Rob Landers wrote:

> Put another way, what is the order of operations for this new operator?
>
> For example, what is the output of
>
> $x ? $y |> strlen(…) : $z
>
> $x + $y |> sqrt(…) . EOL
>
> Etc.
>
> I noticed this seems to be missing from the RFC. As a new operator, I 
> think it should be important to specify that. 
>
> — Rob

Pipe deliberately binds fairly low, so most other operators will happen first.  
Including +, ?? and ? :, for which there are tests:

https://github.com/php/php-src/pull/17118/files#diff-81789df7e324801626ef4ef8f629cc95dceed4c09073a2b58b70c811bf776904

https://github.com/php/php-src/pull/17118/files#diff-56cbcf85bd7f68fa7a1f837eb15dcc536576986f366976f9642ad20867c471fd

https://github.com/php/php-src/pull/17118/files#diff-775c14f54cd1a27719d30bfab62024aeb1625bc3f3621fa0e7c16fb1c7957fdd

So in the examples above, the second would add $x and $y first, then 
square-root the result.  The first, I think would probably need parens to avoid 
being invalid but I'd have to try it to be sure.

--Larry Garfield

Reply via email to