php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #24228 ternary condition
Submitted: 2003-06-17 13:33 UTC Modified: 2003-06-17 13:34 UTC
From: alexdg at joimail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 4.3.1 OS: windows xp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: alexdg at joimail dot com
New email:
PHP Version: OS:

 

 [2003-06-17 13:33 UTC] alexdg at joimail dot com
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).'...'


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-06-17 13:34 UTC] derick@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

try to add some ( and )\'s
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 20:01:28 2024 UTC