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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 03 10:01:33 2025 UTC