On Tue, Sep 24, 2019 at 5:39 AM Peter Stalman wrote:
> On Tue, Sep 24, 2019 at 12:01 AM Bishop Bettini wrote:
> >
> > On Tue, Sep 24, 2019 at 2:26 AM Peter Stalman
> wrote:
> >>
> >> When PHP runs out of memory, a fatal error is triggered and whatever
> shutdown
> >> functions or error handlers
> On Oct 16, 2019, at 5:21 PM, Bob Weinand wrote:
> what's the concrete advantage of this syntax as opposed to the already
> possible:
>
> $value = [
> A1 => A2,
> B1 => B2,
> ][expr()] ?? C;
Speaking specifically to your example, it does not handle multiple cases. IOW,
you cannot do this:
Am 16.10.2019 um 21:19 schrieb Claude Pache
mailto:claude.pa...@gmail.com>>:
Le 16 oct. 2019 à 19:11, Bob Weinand
mailto:bobw...@hotmail.com>> a écrit :
Am 16.10.2019 um 03:46 schrieb David Rodrigues
mailto:david.pro...@gmail.com>>:
Hello. I like to suggests a discussion about a FR to make po
> Le 16 oct. 2019 à 19:11, Bob Weinand a écrit :
>
>
>>
>> Am 16.10.2019 um 03:46 schrieb David Rodrigues :
>>
>> Hello. I like to suggests a discussion about a FR to make possible to
>> inline switch, as an alternative to nested inline conditionals.
>>
>> $value = switch (expr()) {
>>
> Am 16.10.2019 um 03:46 schrieb David Rodrigues :
>
> Hello. I like to suggests a discussion about a FR to make possible to
> inline switch, as an alternative to nested inline conditionals.
>
> $value = switch (expr()) {
>case A1: return A2;
>case B1: return B2;
>default: return C;
>
Hi Robert
That is impossible to implement because there's no way to tell the parser
that `switch` is statement or expression and it conflicts with `=>` in
array key expression (that's why PHP chose to have arrow function with `fn`
prefixed). And IMO your idea is harder to read than normal assignme
On Wed, 16 Oct 2019 at 14:58, Robert Hickman wrote:
> > > > > $say = switch (date("w")) {
> > > case 0 => "weekend!";
> > > case 1, 2, 3, 4, 5 => "weekday :(";
> > > case 6 => "weekend!";
> > > };
> > > echo "Today is {$say}";
>
> If you had a really long expression, it may be easier
> > > $say = switch (date("w")) {
> > case 0 => "weekend!";
> > case 1, 2, 3, 4, 5 => "weekday :(";
> > case 6 => "weekend!";
> > };
> > echo "Today is {$say}";
If you had a really long expression, it may be easier to read if the
assignment was moved to the end, perhaps like this:
sw
On Wed, Oct 16, 2019 at 4:37 AM Kosit Supanyo
wrote:
> I mean separation between cases not case conditions. Examples in your RFC
> uses semicolon as case separator instead of comma.
>
> $say = switch (date("w")) {
> case 0 => "weekend!";
> case 1, 2, 3, 4, 5 => "weekday :(";
> case 6
I mean separation between cases not case conditions. Examples in your RFC
uses semicolon as case separator instead of comma.
"weekend!";
case 1, 2, 3, 4, 5 => "weekday :(";
case 6 => "weekend!";
};
echo "Today is {$say}";
I prefer comma because semicolon should only be used to separate s
Hi Kosit,
śr., 16 paź 2019 o 09:41 Kosit Supanyo napisał(a):
> Hi Michal
>
> I'had the idea similar to your RFC but instead of using `switch` keyword I
> think introducing `when` keyword is better. (as I know a language that uses
> this keyword is Kotlin)
>
> $result = when ($v) {
> 'foo' =>
Hi Michal
I'had the idea similar to your RFC but instead of using `switch` keyword I
think introducing `when` keyword is better. (as I know a language that uses
this keyword is Kotlin)
$result = when ($v) {
'foo' => 1,
'bar' => 2,
'x', 'y', 'z' => 3,
default => null,
};
Above you
12 matches
Mail list logo