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
