|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-11-17 16:50 UTC] jay@php.net
[2003-11-17 21:03 UTC] tagg_maiwald at yahoo dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 23:00:01 2025 UTC |
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