PHP echo() Function
Complete PHP String Reference
Definition and Usage
The echo() function outputs one or more strings.
Syntax
Parameter |
Description |
strings |
Required. One or more strings to be sent to the output |
Tips and Notes
Note: The echo() function is not
actually a function, so you are not required to use parentheses with it. However, if you want to
pass more than one parameter to echo(), using parentheses will generate a parse
error.
Tip: The echo() function is
slightly faster than print().
Tip: The echo() function has the following shortcut syntax. See example 5.
Example 1
<?php
$str = "Who's Kai Jim?";
echo $str;
echo "<br />";
echo $str."<br />I don't know!";
?>
|
The output of the code above will be:
Who's Kai Jim?
Who's Kai Jim?
I don't know!
|
Example 2
<?php
echo "This text
spans multiple
lines.";
?>
|
The output of the code above will be:
This text spans multiple lines.
|
Example 3
<?php
echo 'This ','string ','was ','made ','with multiple parameters';
?>
|
The output of the code above will be:
This string was made with multiple parameters
|
Example 4
Difference of single and double quotes. Single quotes will print the variable
name, not the value:
<?php
$color = "red";
echo "Roses are $color";
echo "<br />";
echo 'Roses are $color';
?>
|
The output of the code above will be:
Roses are red
Roses are $color
|
Example 5
Shortcut syntax:
<html>
<body>
<?php
$color = "red";
?>
<p>Roses are <?=$color?></p>
</body>
</html>
|
Complete PHP String Reference
Make your web applications look like a million bucks
|
|
Most web applications today use boring methods to present data to their viewers using grids or simple HTML tables. FusionCharts induces "life" into the web applications by converting monotonous data into lively charts, gauges & maps.
FusionCharts works with all technologies like ASP, ASP.NET, PHP, ColdFusion, Ruby on Rails, JSP, HTML pages etc.
and connects to any database to render animated & interactive charts. It takes less than 15 minutes and no expertise
whatsoever to build your first chart and just a glance of it to captivate your audience. This fact is endorsed by our
12,000 customers and 150,000 users which include a majority of the Fortune 500 companies.
And yeah, your applications could look like a million bucks by spending just $69.
So go ahead, download your
copy of FusionCharts and start "wow-ing" your customers now!
|
|