Saturday, June 2, 2012

How to start PHP, PHP Syntax to start?


PHP have simple tags to star and ends. PHP star tag is "<?php" and ending with "?>". We place PHP tags anywhere in our page. Normally HTML page have the tags of table or div. we will place any where we want to place PHP.

PHP have the another method to start "<?. This is shorthand methode. Normally we recommended to PHP with "<?php".

Sample PHP

<?php

content need to placed

?>

PHP file extension is ".php".<html>
<html>
<body>


<?php
echo "Welcome to Way2discuss!";
?>


</body>
</html>
In the above example, PHP code written in the body content. PHP script line ends with semicolon.

"echo" - statement used to print the content into our webpage.

PHP have two methods to print the content, One is "echo" and another one is "print".


PHP have the 2 formt to comment the lines as follows

PHP comments : "//" and /* --- */


In PHP, we use // to make a one-line comment or /* and */ to make a comment block:

<html>
<body>

<?php
//This is a way2discuss comment

/*
multi line discussion comment
*/
?>

</body>
</html>

By PHP with No comments

0 comments:

Post a Comment

    • Popular
    • Categories
    • Archives