Le Sat, 21 Nov 2009 09:48:10 +0100, Lukas Kahwe Smith a écrit :

> On 21.11.2009, at 06:12, Alban wrote:
> 
>> This is not a big problem but if a solution exists, this would be so
>> cool ! Especialy when we have to check existance of twenty or more key
>> in array. Code would be be lighter and clear. Since i use PHP, I always
>> have in my 'common function file' a function like that :
>> 
>> function getIssetVar($var, $default) { return ((isset($var)) ? $var :
>> $default); }
>> 
>> So is it possible to make a little improvement on this operator or
>> introduce a new operator or a core function which do that ? What's your
>> feeling about it ?
> 
> 
> this feature request has already been discussed and declined:
> http://wiki.php.net/rfc/ifsetor
> 
> please review this rfc before continuing this thread.
> 
> regards,
> Lukas Kahwe Smith
> m...@pooteeweet.org

Thanks for the link to the RFC :)

Excuse me, but I'll be little hard in this post. This for insult the 
community but I want the community really think about the decision it 
made and the reason why.  

I also read why it have been refused here : 
http://www.php.net/~derick/meeting-notes.html#ifsetor-as-replacement-for-
foo-isset-foo-foo-something-else

Is it serious ? 

«
The name for this new operator is heavily disputed and we could not agree 
on a decent name for it.
»

Tomorrow I will not send food to the association for children who are 
hungry because I can not choose between offering Thai or basmati rice.

Stop sarcasm, seriously, this is not an honorable response from people 
making decisions. Take your responsibility and make a vote or impose a 
name, just do it. 

« 
  Instead of implementing ifsetor() we remove the 
  requirement for the "middle" parameter to the ?: operator. 
»

That's not people wants and that's not do their need.
So that not a correct answer of the php developper demand.

« 
  In combination with the new input_filter extension 
  you then reach the original goal of setting a default 
  value to a non-set input variable with:

  $blahblah = input_filter_get(GET, 'foo', FL_INT) ?: 42;
»

I don't see how do that with the actual filter extension. Even if it is 
possible, this is not a pretty short and easier solution than :

$var = (isset($var)) ? $var : 'default';

Why not add a simple new operator who do the job, this is not needing a 
name :

// set a default value if $var is not set
$var ?= 'default';

// equalivalent to :
$var = (isset($var)) ? $var : 'default';


-- 
Alban Leroux s...@paradoxal.org

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to