Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 07-07-2009
Member
 
Join Date: May 2008
Posts: 53
Information on php echo

echo() is not actually a function (it is a language construct), so you are not required to use parentheses with it. echo() (unlike some other language constructs) does not behave like a function, so it cannot always be used in the context of a function. Additionally, if you want to pass more than one parameter to echo(), the parameters must not be enclosed within parentheses.

echo() also has a shortcut syntax, where you can immediately follow the opening tag with an equals sign. This short syntax only works with the short_open_tag configuration setting enabled.

You can echo array values or use these values directly in your statements.

Say you have an array:

$colors=array('good ', 'very good', 'best');

The above is equivalent to:

$colors[0]="good";
$colors[1]="very good";
$colors[2]="best";

To echo, simply do:

echo $colors[0]; // outputs good
echo $colors[1]; // outputs very good
echo $colors[2]; // outputs best
Reply With Quote
  #2  
Old 07-07-2009
Member
 
Join Date: Dec 2008
Posts: 69
Re: Information on php echo

echo() function is slightly faster than print(). It can output all types of data and multiple outputs can be made with only one echo () command.

Example
<?php echo "welcome to my website "; ?>
Reply With Quote
  #3  
Old 07-07-2009
Member
 
Join Date: Dec 2008
Posts: 29
Re: Information on php echo

<? php function hello_world ()
( echo 'Hello World! " ; ) >

To display Hello World! Anywhere in your code, you will only have to type this:

<? php hello_world () / / calls the "hello_world" which will display "Hello World! ?>
Reply With Quote
  #4  
Old 07-07-2009
Member
 
Join Date: Nov 2008
Posts: 70
Re: Information on php echo

You should take care while using HTML code or any other string that includes quotes. Echo uses quotes to define the beginning and end of the string, Escape your quotes that are within the string with a backslash. To escape a quote just place a backslash directly before the quotation mark.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "Information on php echo"
Thread Thread Starter Forum Replies Last Post
Need to know about Kyocera Echo Corwinn Portable Devices 4 15-02-2011 05:35 PM
What is Echo? What is the difference between Echo and Print statement in PHP? Preetish Software Development 3 05-09-2009 01:41 PM
How To Use Echo statement in PHP Pikachoo Software Development 2 18-03-2009 08:31 AM
Set colors in echo revolucioncg Software Development 3 14-02-2009 09:53 PM
Sound has an echo Tominfl Windows Software 2 15-09-2008 04:35 AM


All times are GMT +5.5. The time now is 04:29 PM.