[RFC] ifsetor operator
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.
I'd prefer to not have this restriction, a return value from a function call should be fine. I'd make this any expression.
- The default value can be any expression. - The default value can be omitted in which case NULL will be used.
I'd also propose to extend this to a whole list of expressions:
"notnull" "(" expression [ "," expression ]* ")"
This would return the first expression which is not null. If all expressions are null then null is returned.
I'm not too happy with "notnull" as a name, better suggestions are welcome :-)
Just brainstorming: An other idea would be an operator like "|||": $a = $a1 ||| $a2 ||| $a3; (I didn't call it "err" or "//" to not get flamed *as* badly ;-))
- Chris
-- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php