php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #62705 Add syntax for short output
Submitted: 2012-07-31 17:49 UTC Modified: 2012-08-01 02:03 UTC
From: bogdan at yurov dot me Assigned:
Status: Wont fix Package: *General Issues
PHP Version: 5.4.5 OS: any
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: bogdan at yurov dot me
New email:
PHP Version: OS:

 

 [2012-07-31 17:49 UTC] bogdan at yurov dot me
Description:
------------
Hello!
It would be great if we could use ternar operator with short syntax. For example:

<?? $var == 123 : 'ok' ?>

... instead of:

<?= $var == 123 ? 'ok' : '' ?>

In php 5.4 short syntax is enabled by default. what if you add this feature (of 
cause, not with exactly same syntax).

Looking forward to you response.

Test script:
---------------
<?= $var == 123 ? 'ok' : '' ?>

Expected result:
----------------
<?? $var == 123 : 'ok' ?>


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-01 02:03 UTC] aharvey@php.net
I don't think we need more variations on the open tag syntax -- if anything, we need less, not more. This would be impossible to Google for, and another variation that would trip up learning developers, who already tend to have a rough enough time with short open tags.

Marking won't fix, subject to the caveat that this could still be pursued as an RFC (which would be more appropriate anyway, as a language level change).
 [2012-08-01 02:03 UTC] aharvey@php.net
-Status: Open +Status: Wont fix
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 08 21:01:33 2024 UTC