Jump to content

Recommended Posts

For a short discussion about the differences between print() and echo(), see this FAQTs Knowledge Base Article: http://www.faqts.com/knowledge_base/view.phtml/aid/1/fid/40

 

I prefer to use echo and its different forms.. like

 

<?= "print this" ?> short tag outputs

 

   echo <<<END

print whatever is here.. just like it is.

This is for some reason refered to as "here document" syntax.

adfa

df

a

d

a

<<<END

 

and the usual ones.

 

echo "hello";

 

echo ("hello");

 

I use print.. only as print_r() for printing arrays during debugging.

This function print_r() is very helpful for printing arrays in a structured manner.

 

For example:

 

$testArray = array("hello", "world");

print_r($testArray);

 

//outputs

array()

{

   [0] = hello

 

   [1] = world

}

Link to comment
https://forums.phpfreaks.com/topic/67438-echo-or-print/#findComment-338512
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.