This was discussed for PHP6, but eventually decided not to have such a
function. Instead, we now have the following:    $var = $_GET['var'] ?: 5;

Taken from http://www.corephp.co.uk/archives/19-Prepare-for-PHP-6.html

'you'd be able to do something like this: "$foo = $_GET['foo'] ?: 42;" (i.e.
if foo is true, $foo will equal 42).'


2009/5/1 Raymond Irving <xwis...@yahoo.com>

>
> Hi Colin and Daniel,
>
> Thanks for the feedback.
>
> I know that this functionality can be added to a framework or a stand alone
> function but I'm assuming that we would not get the same performance:
>
> Case 1
> -----------
> $c = isset($a) ? $a : '';
> // total time = overhead  of isset() + overhead of ?:
>
> Case 2
> -----------
> $c = myWrapper($a,$b)
> // total time = overhead of myWrapper() + overhead of isset() + overhead of
> ?:
>
> Case 3
> -----------
> $c = ifset($a,$b)
> // total time = overhead of ifset()
>
>
>
> Best regards
>
> __
> Raymond Irving
>
> --- On Thu, 4/30/09, Daniel Brown <danbr...@php.net> wrote:
>
> > From: Daniel Brown <danbr...@php.net>
> > Subject: Re: [PHP] Two very useful PHP functions
> > To: "Raymond Irving" <xwis...@yahoo.com>
> > Cc: php-general@lists.php.net
> > Date: Thursday, April 30, 2009, 11:37 AM
> > On Wed, Apr 29, 2009 at 22:32,
> > Raymond Irving <xwis...@yahoo.com>
> > wrote:
> > >
> > > What do you think? Can they make it into 5.3?
> >
> >     Not when doing the ternary operator that you
> > even displayed
> > yourself takes up less code and time than a core function
> > would.  It's
> > a good idea, but better handled on the frontend of
> > things.  You may
> > want to consider contributing that to a framework, which is
> > where it
> > would be more appropriate.
> >
> > --
> > </Daniel P. Brown>
> > daniel.br...@parasane.net
> > || danbr...@php.net
> > http://www.parasane.net/ || http://www.pilotpig.net/
> > 50% Off All Shared Hosting Plans at PilotPig: Use Coupon
> > DOW10000
> >
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Reply via email to