#43565 [Opn->Bgs]: the alternative IF syntax doesnt work with echo

From: Date: Tue, 11 Dec 2007 14:33:25 +0000
Subject: #43565 [Opn->Bgs]: the alternative IF syntax doesnt work with echo
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-120567@lists.php.net to get a copy of this message
ID: 43565 Updated by: derick@php.net Reported By: peter at 3p1 dot net -Status: Open +Status: Bogus Bug Type: Compile Failure Operating System: linux PHP Version: 5.2.5 New Comment: 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 . Previous Comments: ------------------------------------------------------------------------ [2007-12-11 14:26:05] 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']); ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=43565&edit=1

« previous php.bugs (#120567) next »