# [RFC] ifsetor operator

- Thread: https://externals.io/message/9275
- Original archive: https://news-web.php.net/php.internals/9275
- Started by Jason Garber on 2004-04-16T20:02:42+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #9275 — Jason Garber — 2004-04-16T20:02:42+00:00

URL: https://externals.io/message/9275#9275

I completely agree with the EXACT way Marcus has proposed this operator.

The key is that the first argument must be a Variable, because it is tested 
to see if it ISSET(), not if it's null.  That is why you can't have any 
expression for the first argument - it would be like calling isset('foo'), 
which does not make any sense.

I think that this internal function addresses the need exactly, and that 
the correct solution has been arrived at.

Thanks Marcus!

Sincerely,
Jason Garber


At 4/16/2004 09:38 PM +0200, Marcus Boerger wrote:
>[RFC] ifsetor operator
>
>Hello List,
>
>   i also agrre that an internal function is much better. And here is
>it as such an internal function (that does not result in an expensive
>function call).
>
>Synopsis: "ifsetor" "(" value "," default ")"
>
>   Returns the value if it exists or a given default value.
>
>Syntax:   "ifsetor" "(" variable [ "," expression ] ")"
>
>Semantic:
>   - The value in question must be a variable.
>   - The default value can be any expression.
>   - The default value can be omitted in which case `NULL` will be used.
>
>http://marcus-boerger.de/php/ext/ze2/ze2-ifsetor-20040416-2.diff.txt
>
>best regards
>marcus
>
>
>Friday, April 16, 2004, 2:12:04 AM, you wrote:
>
> > […]
>
> > […]
>
> > […]
>
> > […]
>
> > […]
>
> > […]
>
> > […]
>
> > […]
>
> > […]
>
> > […]
