cramerz logo

Php Output Data


In php language we can output data by using a PHP Language Construct known as echo. Construct are elements that are built into language. echo can be used for outputting any data. It can also be used to output HTML

Example of PHP echo


<?php

echo "this is my echo message"; 

?>

The above example will show this message on webpage. this is my echo message.

Another Example of PHP echo


<?php

echo "this is my echo message";

echo "<BR>";

echo "this is my second line with echo command";

echo "<BR>";

echo "<B>this is a bold message by using php echo</B>";

?>

 

PHP Print ()

echo is a construct, but a function called print() can also be used to echo data.



<?php

print(30);//this will output 30

?>

 

PHP Hello, World Example

Here is the PHP equivalent of the class "Hello, World" programming example:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<title>Hello World in PHP</title>
</head>

<body>

<?php echo "<h1>Hello, World!</h1>"; ?>

</body>
</html>


The above script will generate an HTML document with a Heading one "Hello, World!"



all rights reseverd by Cramerz.com©. web design & web development by DotPeak. hosting by HostBay
all contents on cramerz are the property of Cramerz.com. web design courses