Echo versus Question Mark Equals

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I'm taking a look at a piece of PHP code that begins:

      $doc_title = 'Business Registration';
      echo "$doc_title\n";
     <?= $doc_title ?>

What's the difference here between the <echo "$doc_title\n"> statement
and the <?= $doc_title ?> statement?  Are they synonyms for each
other, or are there differences that I don't see?

                                ---Kevin Simonson

"You'll never get to heaven, or even to LA,
if you don't believe there's a way."
from _Why Not_

Re: Echo versus Question Mark Equals wrote:

Quoted text here. Click to load it

See here:

And read carefully Example 10.2

Iván Sánchez Ortega -ivansanchez-algarroba-escomposlinux-punto-org-

The solution of this problem is trivial and is left as an exercise for the
                                    -- Standard textbook cookie

Re: Echo versus Question Mark Equals

On Mon, 06 Aug 2007 22:10:29 +0200, Iván Sánchez Ortega  

Quoted text here. Click to load it

And take special care reading the last note:
"Note: Using short tags should be avoided when developing applications or  
libraries that are meant for redistribution, or deployment on PHP servers  
which are not under your control, because short tags may not be supported  
on the target server. For portable, redistributable code, be sure not to  
use short tags."
Rik Wasmus

Site Timeline