php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43565 the alternative IF syntax doesnt work with echo
Submitted: 2007-12-11 14:26 UTC Modified: 2007-12-11 14:33 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: peter at 3p1 dot net Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 5.2.5 OS: linux
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: peter at 3p1 dot net
New email:
PHP Version: OS:

 

 [2007-12-11 14:26 UTC] peter at 3p1 dot net
Description:
------------
// Try this
$meta = array();
$meta['foo'] = 'bar';
$meta['foo2'] = 'bar2';

//-- THIS DOES NOT WORK -- 
($meta['foo']) ? print $meta['foo']  : echo ($meta['foo2']);

//-- THIS DOES WORKS -- 
($meta['foo']) ? print $meta['foo']  : print ($meta['foo2']);

Reproduce code:
---------------
// Try this
$meta = array();
$meta['foo'] = 'bar';
$meta['foo2'] = 'bar2';

//-- THIS DOES NOT WORK -- 
($meta['foo']) ? print $meta['foo']  : echo ($meta['foo2']);

//-- THIS DOES WORKS -- 
($meta['foo']) ? print $meta['foo']  : print ($meta['foo2']);


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-11 14:33 UTC] derick@php.net
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Dec 03 06:00:02 2025 UTC