PHP
  Home arrow PHP arrow Page 2 - Programming PHP: A Beginner`s Guide
Dev Shed Forums 
Administration  
AJAX  
Apache  
BrainDump  
DHTML  
Flash  
Java  
JavaScript  
Multimedia  
MySQL  
Oracle  
Perl  
PHP  
Practices  
Python  
Reviews  
Security  
Style-Sheets  
Web Services  
XML  
Zend  
Zope  
Forums Sitemap 
IBM® developerWorks 
Sun Developer Network 
Dedicated Servers 
E-Commerce Hosting 
Linux Web Hosting 
Managed Hosting 
Small Business Hosting 
Moblin 
JMSL Numerical Library 
VPS Hosting 
Weekly Newsletter

 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Programming PHP: A Beginner`s Guide
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 19
    2007-10-29

    Table of Contents:
  • Programming PHP: A Beginner`s Guide
  • PHP Means PHP: Hypertext Preprocessor
  • Variables
  • Working with Strings

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Programming PHP: A Beginner`s Guide - PHP Means PHP: Hypertext Preprocessor


    (Page 2 of 4 )

    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.

    Syntax

    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.]


    <html>

    <body>


    <?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


    </body>

    </html>

    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:


    <html>

    <body>


    <?php


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

    use those stupid // symbols

    Blah blah blah

    ti-blah

    */


    ?>


    </body>

    </html>

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

    More PHP Articles
    More By James Payne


       · Hey thanks for dropping in for this series covering PHP. In this episode we learn...
       · Hi,first, I must say that trying to help beginners is always a good idea. But...
     

       

    PHP ARTICLES

    - Paginating Database Records with the Code Ig...
    - HTTP Headers in Web Development
    - Project Management: Administration
    - Building a Database-Driven Application with ...
    - User Authentication for a Project Management...
    - Introduction to the CodeIgniter PHP Framework
    - Adding Users for a Project Management Applic...
    - Migrating Class Code for a MIME Email to PHP...
    - Login and Logout Authentication for a Projec...
    - Composing Messages in HTML for MIME Email wi...
    - Project Management: Authentication
    - A Better Way to Determine MIME Types for MIM...
    - Project Management Overview
    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway