PHP Program 1 : Write a PHP script to display welcome message && write a PHP script to display given paragraph.
Software Required: - Notepad, WordPad, Notepad++, Dreamweaver,Wamp/Xampp
Pre-requisite: - Basic knowledge of editor
Theory/Logic: -
v Structure: -
<?php
.................................................................
// Code or statement to be executed on the server side
.................................................................
?>
Ø Whenever requesting a web page with a .php extension the server locates the requested file and executes the script that is specified between <?php and ?> tag and returns output in form of just HTML back to the user.
v Rules of PHP syntax: -
Ø You must follow the following rules for PHP syntax: -
1. The script of PHP must contain between <? php?>
2. Every statement inside <? php?> must end with a semicolon.
3. String must contain either a single quotation mark or a double quotation mark.
4. You can make a line as a comment using either // or /* */.No other symbols are permitted for making a line as a comment. Every variable in a script must start with the $sign.
5. Name of the variable cannot start with a digit and it cannot contain white spaces.
6. PHP is case-sensitive.
v Code: -
<html>
<head>
<title>PHP
Program</title>
</head>
<body>
<?php echo
"<u>WELCOME TO THE WORLD OF PHP</u><br /><br
/>Thanks for visitting our website.<br /><br
/><br
/><p><h2> We are glad to have you with us.<br>
We will serve as
good as possible and we will give our best.</h2></p>" ?>
</body>
</html>
v Output: -
No comments: