#24228 [NEW]: ternary condition
| From: | alexdg at joimail dot com | Date: | Tue, 17 Jun 2003 18:33:06 +0000 |
| Subject: | #24228 [NEW]: ternary condition | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-42147@lists.php.net to get a copy of this message | ||
From: alexdg at joimail dot com
Operating system: windows xp
PHP version: 4.3.1
PHP Bug Type: Unknown/Other Function
Bug description: ternary condition
Description:
------------
maybe i'm dumm, but i can't understand why the following code doesn't work
properly.
strlen($s_fnc_note) is > 45, but it echoes ' ' instead.
Reproduce code:
---------------
$s_fnc_note = 'asf asf asfda sdf asdfa sf asdf asdf asdf asdf asdf asdf
asdfasdf asdf asdfasdf asdfasdf asdfas asdfasdfasdf asdfasdf';
echo (strlen($s_fnc_note) >
45)?substr($s_fnc_note,0,42).'...':(strlen($s_fnc_note) ==
0)?' ':$s_fnc_note;
Expected result:
----------------
i do expect to echo substr($s_fnc_note,0,42).'...'
--
Edit bug report at http://bugs.php.net/?id=24228&edit=1
--
Try a CVS snapshot: http://bugs.php.net/fix.php?id=24228&r=trysnapshot
Fixed in CVS: http://bugs.php.net/fix.php?id=24228&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=24228&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=24228&r=needtrace
Try newer version: http://bugs.php.net/fix.php?id=24228&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=24228&r=support
Expected behavior: http://bugs.php.net/fix.php?id=24228&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=24228&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=24228&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=24228&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=24228&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=24228&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=24228&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=24228&r=gnused