PHP Tutorial / Hello World

Document Sample
PHP Tutorial / Hello World Powered By Docstoc
					                                PHP TUTORIAL #1
                                          written by Marc Hershey

                                   Your First PHP Page!
Table Of Contents:
1. What is PHP?
2. PHP: Hello World

If you are reading this tutorial, you are probably a first-time beginner with PHP. That's
alright, everyone had to start at this point sometime in their astonishing journey in the
world of computer languages. So you might be asking, "Where do I start?" Well, lets
start off by teaching you the world's famous tutorial called, "PHP / Hello World!" This
tutorial will teach you the simple details in coding with PHP. First off, lets teach you what
PHP is exactly.

1. What is PHP?
PHP is a general-purpose server-side scripting language originally designed for web development to
produce dynamic web pages. It is among one of the first developed server-side scripting languages that is
embedded into a HTML source document, rather than calling an external file to process data. Ultimately,
the code is interpreted by a web server with a PHP processor module which generates the resulting web
page. It also has evolved to include a command-line interface capability and can be used in standalone
graphical applications. PHP can be deployed on most web servers and also as a standalone shell on
almost every operating system and platform free of charge. A competitor to Microsoft's Active Server
Pages (ASP) server-side script engine and similar languages, PHP is installed on more than 20 million
websites and 1 million web servers.

To dumb all that up for you, PHP is a computer scripting language (web based) and
unlike most languages, it is a server-side scripting language. All the processes and
actions are "acted" on the server, and not your computer. PHP is embedded into HTML
which pretty much means, PHP is coded inside of HTML, rather than the code being
brought in from another page, or external file. You can find so much more information

Ok, not that you have a little bit of knowledge, lets get this started.

2. PHP: Hello World
Lets now get into the dirty work! To start off by simply creating a file, and naming it,
"index.php" After that is completed, lets place the basic HTML codes in the file. Yes, I
know this isn't an HTML tutorial, but I also stated that PHP is embedded into HTML.
Yes, you can have PHP alone in a file, which will work just fine, but I'm going to teach
you the proper way to exacute PHP. Once you have the file open and read to edit, place
the follow HTML into the file: (BTW: it's better if you type everything in, instead of copy
and paste. Typing everything will help you better memorize it for future reference.)
<head><title>PHP Tutorial</title></head>
<p>Content of your page in here.</p>

Once you have typed all of it in, now lets enter the PHP code in. The following code will
be an echo command, which simply "echos" or "says" the text that it is commanded to
do. Here is the code:
<?php echo '<p>Hello World</p>'; ?>

The above code will simply show "Hello World" on the webpage. Go ahead! Try it out!
The final code should look like this:
<head><title>PHP Tutorial</title></head>
<?php echo '<p>Hello World</p>'; ?>

Another great thing to look at, is the source code of your page. It will give you the idea
of exactly what "echo" does. It prints out what is in the quotes! If you would like to
perfect        this,     and          learn     even        more,         click      here: This will show you and explain
EVERYTHING you need to know! Hope you enjoyed this tutorial.


This document is in the format of a tutorial and is for learning purposes only. This document is free of charge and may be distrubuted
to whomever requests this document. This document was created by Marc Hershey of

If you have any questions, please redirect them to

Shared By:
Description: PHP Tutorial / Hello world This file is to better help you with your PHP skills. This is the first tutorial for PHP but will not be the last! If you are looking to learn PHP, it's best to start here!
Marc Hershey Marc Hershey N/A
About I am an internet entrepreneur that likes to explore new things and figure out how stuff works on my own. My main enjoyment on the computer is PHP programming.