From:             tagg_maiwald at yahoo dot com
Operating system: Windows 98
PHP version:      4.3.4
PHP Bug Type:     Feature/Change Request
Bug description:  conditional concatenator

Description:
------------
A conditional concatenator would evaluate a boolean test, then concatenate
a value onto the left operand. This operator would simplify scripts by
eliminating a kludge. The motive behind this request is to readily
construct SQL queries via PHP which can be easily reread and understood
with minimal confusion by a follow-on person maintaining the script(s).

Reproduce code:
---------------
// kludge
$sz_string = 'foo';
if ($bool_test) { $sz_string .= 'bar'; }
else { $sz_string .= 'baz'; }
echo $sz_string

// conditional concatenator
$sz_string = 'foo';
$sz_string .? ($bool_test) 'bar' : 'baz';
echo $sz_string

Expected result:
----------------
foobar

Actual result:
--------------
foobar

-- 
Edit bug report at http://bugs.php.net/?id=26273&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=26273&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=26273&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=26273&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=26273&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=26273&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=26273&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=26273&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=26273&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=26273&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=26273&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=26273&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26273&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=26273&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=26273&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=26273&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=26273&r=float

Reply via email to