Home arrow PHP arrow Page 2 - Programming PHP: A Beginner`s Guide

PHP Means PHP: Hypertext Preprocessor - PHP

PHP has been taking the web by storm because of its power and versatility. If you'd like to add PHP-based applications to your web site, keep reading. This series of articles will teach you the language from scratch.

  1. Programming PHP: A Beginner`s Guide
  2. PHP Means PHP: Hypertext Preprocessor
  3. Variables
  4. Working with Strings
By: James Payne
Rating: starstarstarstarstar / 19
October 29, 2007

print this article



Ow! That makes my brain hurt. How can the P in PHP stand for PHP? Doesn't that create some infinite name like PHP: Hypertext Preprocessor PHP...bah you get the point. Its like that boxer George Foreman; you know the guy has been hit in the head too many times because all five of his children have the same exact name as him. I mean, even the things he invents have the same name. Don't think that's crazy? Call his house and ask to speak to George Foreman. See how long it takes to figure out the right one.

Before we begin, I am going to assume several things:

  • You know HTML

  • You have a modicum (yay big word) of scripting know how

  • You know what modicum means or can look it up in google

  • You have installed an Apache server, PHP, and MySQL on your computer

If you mentioned no to any of those (except the modicum one; you can skip that), then avert your beady eyes from my tutorial and go rectify the situation. If you answered yes to all of those, then come on in. Grab yourself a warm mug of hot cocoa and let us discuss the legacy of the first programming language created by a Yeti.


When programming blocks of PHP, you must always start with <?php and end with ?>. This tells the interpreter that the line of code you have written is PHP. Remember when you right PHP, you will usually be intermingling it with HTML.

Most tutorials start you off with that dumb "Hello World" script. Forget that. We are l33t PHP h4xors now. We don't want the world to know we exist. We are like ninjas. Or like that song from the Patrick Swayze movie: Like the Wind.

Does that guy ever wear a shirt by the way? [Does he need to? --Ed.]



<?php // This tells the browser you are using PHP

echo "Shhhh...don't tell the world we are here h4xoring their bases";

?> // This ends your PHP block of code



The above would print the following to your monitor:

  Shhhh...don't tell the world we are here h4xoring their bases

In the above code, the echo command tells the computer to print what follows it to the monitor. You can also use the print command.

You will also notice the semicolon (;). This is a separator, placed at the end of a statement, that tells the program that this line is finished. Basically, it keeps your instructions separate.

You might have wondered about the // in the above example. This is called commenting. When PHP sees the // it skips everything on that line after it. You use comments to leave notes to future programmers (or even yourself) about what this line or block of code was used for.

If you want to do a whole block of comments, you can do this:




/* I have a bunch of comments to make and am too lazy to

use those stupid // symbols

Blah blah blah






Anything between the /* and */ is ignored by the program.

>>> More PHP Articles          >>> More By James Payne

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Hackers Compromise PHP Sites to Launch Attac...
- Red Hat, Zend Form OpenShift PaaS Alliance
- PHP IDE News
- BCD, Zend Extend PHP Partnership
- PHP FAQ Highlight
- PHP Creator Didn't Set Out to Create a Langu...
- PHP Trends Revealed in Zend Study
- PHP: Best Methods for Running Scheduled Jobs
- PHP Array Functions: array_change_key_case
- PHP array_combine Function
- PHP array_chunk Function
- PHP Closures as View Helpers: Lazy-Loading F...
- Using PHP Closures as View Helpers
- PHP File and Operating System Program Execut...
- PHP: Effects of Wrapping Code in Class Const...

Developer Shed Affiliates


Dev Shed Tutorial Topics: