Req #52148 [Opn]: Modify ternary operator request
| From: | clouster at yandex dot ru | Date: | Tue, 22 Jun 2010 14:37:22 +0000 |
| Subject: | Req #52148 [Opn]: Modify ternary operator request | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-151770@lists.php.net to get a copy of this message | ||
Edit report at http://bugs.php.net/bug.php?id=52148&edit=1
ID: 52148
User updated by: clouster at yandex dot ru
Reported by: clouster at yandex dot ru
Summary: Modify ternary operator request
Status: Open
Type: Feature/Change Request
Package: *Programming Data Structures
Operating System: all
PHP Version: Irrelevant
New Comment:
sorry for "stream of consciousness" and my bad english :)
Actually when i said "modify ternary operator" i mean to add new ternary
operator.
Previous Comments:
------------------------------------------------------------------------
[2010-06-22 16:35:23] clouster at yandex dot ru
Description:
------------
There is a need for another operator, which would reduce the code
dramatically.
Be sure there are situations when stupid testing for validity get load
of code,
so i suggest modify ternary operator ( expression ? true : false ) to
next
variant:
$foo = "hello";
$bar = "world";
$output = $foo ? $bar;
$output is "hello";
$foo = null (0, false, etc);
$bar = "world";
$output is "world";
Test script:
---------------
$foo = false;
$bar = "foo";
echo $foo ? "bar";
echo $bar ? "bar";
Expected result:
----------------
bar
foo
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=52148&edit=1