| Introduction | Getting Started | A Useful Example | Templates | Conclusion | ||||||
Introduction to PHP: Getting Started
PHP scripts are like HTML files, but instead of .htm or .html extension, they are given .php extension. Within the file, PHP code is contained in <?php ?> tags.
Let's take a look at a very simple PHP script, that displays "Hello, World!" in the browser window.
I have put the following in a text-only file called example1.php, and uploaded the file to the server.
Example 1: "Hello, World!"
<html> <head> <title>Example 1</title> </head> <body> <?php // Say Hello! echo "Hello, World!"; ?> </body> </html>
When we view the source of Example 1 in the browser, we notice the following.