Re: [PHP-DEV] Re: New operator suggestion

2021-09-04 Thread David Kolář - Micropro Software
Well, yes, but not exactly. What I dislike on ?? operator is, that it supress all warnings in the expression - in my opinion it shares the same issue as @ operator and why people discourage other to use it - because it may supress far more errors than you want to supress. And this is the case w

[PHP-DEV] Re: New operator suggestion

2021-09-04 Thread Ben Ramsey
David Kolář wrote on 9/4/21 17:19: > Back to the suggestion - I suggest creating a new IFNULL operator, which > will simply test if > expression is null. If not, it returns left-hand part, if yes, it > returns right-hand part. This is already what the `??` operator does. For example: https://3v4l.

Re: [PHP-DEV] Re: New Operator

2006-03-15 Thread bertrand Gugger
Brian Moon wrote: Oh, you want an operator to do that? Does some other language have this that we are wanting to copy here? Seems overly complicated to me. But, so does a lot of things being added PHP these days. As bash ${parameter:=word} ? -- toggg -- PHP Internals - PHP Runtime Develop

Re: [PHP-DEV] Re: New Operator

2006-03-14 Thread Nico Edtinger
Brian Moon wrote: Oh, you want an operator to do that? Does some other language have this that we are wanting to copy here? IIRC C# 3.0 adds a new operator ?: written as "foo = bar ?: 'default value';". I tried to search a resource with some documentation about this new operator, but Goog

Re: [PHP-DEV] Re: New Operator

2006-03-14 Thread Brian Moon
But you still don't have a default value, just an empty default value(string, zero, etc.). You can't i.e. initialize $_GET["ConfirmCode"] with "Yes" using settype... Oh, you want an operator to do that? Does some other language have this that we are wanting to copy here? Seems overly complica

Re: [PHP-DEV] Re: New Operator

2006-03-14 Thread Cristiano Duarte
Brian Moon wrote: >>> $ConfirmCode = (isset($_GET['ConfirmCode']) ? $_GET['ConfirmCode'] : >>> ''); >> I agree that this is really a PITA, but until we get an operator for >> this, we should stuck on the ternary. > > > Another option is to use settype(); This has two advantages. One, if >

Re: [PHP-DEV] Re: New Operator

2006-03-14 Thread Brian Moon
$ConfirmCode = (isset($_GET['ConfirmCode']) ? $_GET['ConfirmCode'] : ''); I agree that this is really a PITA, but until we get an operator for this, we should stuck on the ternary. Another option is to use settype(); This has two advantages. One, if the variable does not exist, settype

[PHP-DEV] Re: New Operator

2006-03-14 Thread Cristiano Duarte
Jason Garber wrote: > Hello internals, > > Since nobody could seem to agree on a language construct for > accessing a variable that you don't know exists (ifsetor), > I would like to propose a simpler approach. > > It returns the value of the passed variable, or NULL if the variable >