My First PHP Program

PHP Program must run on a PHP enabled web server.

A PHP Program can be placed anywhere in the document. A PHP script starts with <?php and ends with ?>

first php program

The default extension of PHP file is .php

Writing First PHP Program

A PHP script file normally contains HTML tags and some PHP scripting code.

example:

<html>
<body>

<h1> My First PHP Page </h1>

<?php

echo "Hello World";

?>

</body>

</html>

echo is built-in PHP function to output the text on a web page.

Save this file with .php extension. create a public folder, save this file in this folder. Save this folder in www folder on WAMP server.

# Start Server

# Type in Browser “http://localhost/

# Navigate to the folder where we have placed the php file.

# Open your php file in browser. it will display your newly created page.

 

Facebooktwittergoogle_pluspinterestlinkedinmail

Leave a Reply