ID: 12735
Updated by: yohgaki
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: Feature/Change Request
PHP Version: 4.0.6
New Comment:

Won't change....
You can use "or"/"and" also.



Previous Comments:
------------------------------------------------------------------------

[2001-08-14 03:30:21] [EMAIL PROTECTED]

Providing default values for fields, I find myself using the following
syntax a lot:

$a = $result->f('asd'); if (!$a) $a = 'nothing';

$a = ($result->f('asd') ? $result->f('asd') : 'nothing');

Generally:

$a = ($x ? $x : $y);

It would be handy to have a shorthand for this that would easy typing,
legibility, and avoid duplicate evaluation of $x.

Proposed syntax (not fussy)

$x ?: $y

i.e. if 'value if true' is empty, use 'condition value'.

------------------------------------------------------------------------



Edit this bug report at http://bugs.php.net/?id=12735&edit=1


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to