Marc Richards wrote:
> 
> Well I'm partial to ?: and there seemed to be some support for it, but
> there also seemed to be a non-trivial (though not necessarily difficult)
> amount of work to get it to work right.
> 
> ifsetor() is obviously less concise, but also the name at first glance
> is a little non-obvious/confusing. I suppose isset() suffers from the
> same problem, and people will eventuall get used to it.
> 
> If the technical problems can be overcome, I'm all for ?: otherwise
> ifsetor() seemed like the best suggestion so far.  I am far less
> qualified to come up with an alternative than the more experienced
> PHP'ers out there.
> 
> 
> Marc

As far as the name is concerned, I'm kind of partial to coalesce(), as the
purpose of the function is really similar to the SQL function of the same
name. This is from the Postgres manual, although I think the function
itself is from SQL99:

"The COALESCE function returns the first of its arguments that is not null.
Null is returned only if all arguments are null. This is often useful to
substitute a default value for null values when data is retrieved for
display, for example:

SELECT COALESCE(description, short_description, '(none)') ..."

In effect, that's more or less what this function is supposed to as I
understand it -- in PHP's case, it returns the first argument from its
argument list that is set and has a value, if none is found it returns
NULL. 

Personally, I like coalesce() if only because of my familiarity with the SQL
function. I know that many PHP users are familiar with SQL, although how
many are familiar with coalesce() is another matter. 

J

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

Reply via email to