Saturday, February 18, 2012

Outputting A String

Thank you for reading my Blog.
We have done in previous lesson use PHP " echo " .we can also use the "ptint" function as like as C programming.
You can place either a string variable or you can use quotes,like i do below, to create a string that the echo/print function will output.

**************************************
<body>
<?php
$myString="Hello ! Welcome to Mint PHP ";
echo $myString."<br/>";
echo 'I love PHP :)'."<br/>";
print "You can also use print as like as \"echo\".";
?>

</body>
</html>
*******************
Display:

Hello ! Welcome to Mint PHP
I love PHP :)
You can also use print as like as "echo".

********************************
Note:
         In the above example the output "Hello ! Welcome to Mint PHP " without a hitch. The text we are outputting is being sent to the user in the form of a web page, so it is impotent that we use proper HTML syntax !

In the above example I also use concatenation. [ ."<br/>" ]  =>  [ . (dot) ]

No comments:

Post a Comment