Hi David, I'm interested in this feature this is called switch expression and is on my list of RFC to process after Object Initializer RFC.
I have an RFC in draft for that and planning to finish it soon together with some syntax optimisations - you can see it at https://wiki.php.net/rfc/switch-expression-and-statement-improvement Cheers, Michał Brzuchalski śr., 16 paź 2019, 03:46 użytkownik David Rodrigues <david.pro...@gmail.com> napisał: > 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; > } > > Instead of: > > $expr = expr(); > $value = $expr == A1 ? A2 : ( $expr == B1 ? B2 : C ); > > Just a discussion to check what do you think. > > -- > David Rodrigues >