On 8 February 2018 18:38:36 GMT+00:00, Mcmuffin Mcguffin
wrote:
>Hi,
>
>It's a common idiom in object-oriented languages to create an object
>and
>then immediately call a method on it, such as (in C# or Java):
>
>new DateTime ().ToString ()
>
>However, PHP grammar does not work this way.
This wo
>
> Is that creating an instance of the class name stored in the 0th index of
> the array $var or is it creating an instance of the class name stored in
> $var and accessing the 0th index using ArrayAccess?
>
As soon as $var gets involved, it should be prioritized above the new
operator. So it's e
Great contribution, very sensible even if subtile.
Is the kind of change that improve a lot but cause some trouble to people
used to the old way or when upgrading legacy codebases.
2018-02-15 5:32 GMT-03:00 Stephen Reay :
>
> > On 9 Feb 2018, at 01:38, Mcmuffin Mcguffin
> wrote:
> >
> > new $va
> On 9 Feb 2018, at 01:38, Mcmuffin Mcguffin wrote:
>
> new $var[0]
Is that creating an instance of the class name stored in the 0th index of the
array $var or is it creating an instance of the class name stored in $var and
accessing the 0th index using ArrayAccess?
Cheers
Stephen
--
PHP
On 2/8/2018 7:38 PM, Mcmuffin Mcguffin wrote:
> What do you think?
>
> Jaroslav Wegner
>
Thanks for the hard work to figure out what the roots of this annoyance
is. This could land in the next PHP version, considering that many other
breaking changes were also allowed in the past, given the foll
I really like the proposal and it's definitely improving more common modern
use cases.
However, I understand why the precedence is like that now in PHP to begin
with and so I think this should target PHP 8.
This change would be a bit similar to other weird use cases of variables
which were change
Hi,
It's a common idiom in object-oriented languages to create an object and
then immediately call a method on it, such as (in C# or Java):
new DateTime ().ToString ()
However, PHP grammar does not work this way. You have to put an additional
round of parentheses around new clause, such as:
(ne