2014/1/16 Robert Stoll <[email protected]>
>
>
> > -----Original Message-----
> > From: Andrea Faulds [mailto:[email protected]]
> > Sent: Thursday, January 16, 2014 12:54 AM
> > To: Crypto Compress; [email protected]
> > Subject: Re: [PHP-DEV] Introducing "Array Of" RFC
> >
> >
> >
> > On 15/01/14 23:18, Crypto Compress wrote:
> > > e.g.: function foo(Bar[null] = null)
> >
> > I'd prefer the ? syntax for nullables that C# has. I'm imagining
> > something like this:
> >
> > function foo(Bar? $a) {} // $a is Bar/null
> > function foo(Bar?[] $a) {} // $a is array of Bars/nulls
> > function foo(Bar[]? $a) {} // $a is array of Bars, or null
> > function foo(Bar?[]? $a) {} // $a is array of Bars/nulls, or null
> >
> > --
> > Andrea Faulds
> > http://ajf.me/
> >
> > --
>
> I like Andrea's proposal, this way we can support all scenarios.
> It is possible to define that NULL is a valid entry in an array and we
> would stick to the same decision as for actual
> parameters, namely that one has to define explicitly that null is a valid
> entry. This would make me happy and I suppose
> also Philip.
>
> Just as side notice, this syntax would also give the chance for PHP to get
> rid of the double meaning of "=null" in a
> later version. I am talking about the following case:
> function foo(Foo $a=null, $b=1){}
> Where one might not want to specify that $a is optional but cannot do it
> differently at the moment - with the additional
> ? it could change :)
>
>
> --
> PHP Internals - PHP Runtime Development Mailing List
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
+ 1 for the RFC
But if i'm not completely wrong, there is performance decrease instead of
increase in your tests?
https://gist.github.com/krakjoe/8444591
[joe@fiji php-src]$ sapi/cli/php isTest.php 10000
objects: 10000
arrayof: 0.00645113
instanceof: 0.00560713