Re: what happened to that new isset() like language
| From: | Marcus Boerger | Date: | Sat, 10 Jul 2004 00:00:55 +0000 |
| Subject: | Re: what happened to that new isset() like language | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-11052@lists.php.net to get a copy of this message | ||
Hello John,
we are not testing against NULL here. We check for existance.
That would be having a uniform sql way to test the existance of
a table or column in a table. Hence IFNULL(), NOT IFNULL(),
NVL() are different. I also explained several times why coalesce
doesn't apply.
Friday, July 9, 2004, 6:42:10 PM, you wrote:
> Hi,
> I would suggest another name for ifsetor.
> In relational databases, there is a similar function, called NVL in oracle,
> and IFNULL in MySQL and coalesce in postgresql for testing for null, and
> returning a default value if the variable is null.
> I think ifsetor sounds a big ugly. I would suggest ifset($var,
> $defaultvalue), as there are historical analogies with mysql's
> IFNULL function, and i think ifset looks different enough from
> isset, thanks to the tall 'F'.
read top...IFNULL === is_null which has nothing to do with isset()
> $var = isset($aval) ? $aval : 0;
> $var = ifset($aval, 0);
That suggests it returns 0 if $val is set and not what you describe above.
To explain why i chose "ifsetor" try to read it as:
"if" <var> "set" return it "or" return <expr>
regards
marcus