Re: [RFC][Under discussion] Arbitrary string interpolation

From: Date: Mon, 21 Mar 2022 09:51:15 +0000
Subject: Re: [RFC][Under discussion] Arbitrary string interpolation
References: 1 2 3 4 5 6 7 8  Groups: php.internals 
Request: Send a blank email to internals+get-117388@lists.php.net to get a copy of this message
On 20/03/2022 13:39, Rowan Tommins wrote:
Using a second colon would make ternary expressions slightly awkward; C# handles this by requiring them to be parenthesised, so "{$:( $test ? $x : $y )}" would be valid but "{$:$test ? $x : $y}" would not; we could use some other delimiter, but they'd probably all need something similar.
Thinking about it, a second colon might also cause problems for expressions like "{$: Foo::bar() }", so since we have multiple symbols at the start anyway, how about a prefixed formatting argument, e.g. "{$%10.3f: $x }" Regards, -- Rowan Tommins [IMSoP]

« previous php.internals (#117388) next »