PHP
  Home arrow PHP arrow Page 3 - 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 
Actuate Whitepapers 
VeriSign Whitepapers 
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

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    Programming PHP: A Beginner`s Guide - Variables


    (Page 3 of 4 )

    The best way to think of a variable is to think of a box. You store things in them. You can put stuff in them, take things out, move them around, and so forth. If you are an angry UPS guy who has some computer parts we just ordered, you can slam it on the floor and kick it a few times while glaring at all of the employees. Then you can politely ask for the signature and storm out (you know who you are!).

    Variables in PHP (and in programming languages in general) store data. Most programming languages are a real pain in the butt and make you define what type of data is being stored. Not PHP. In Soviet Russia, PHP tells you what type of data is in the variable!

    (Note: A special thanks to the great world-renowned comedian Yakov Schmirnoff).

    Here is how you work with variables:


    <html>

    <body>


    <?php

    $the_greatest = "James Payne";

    echo $the_greatest;


    ?>


    </body>

    </html>

    The above code store the string (or text) James Payne in a variable named $the_greatest. We then used echo and told it to print the value of $the_greatest. Which would result in:

      James Payne

    A note about naming variables. They must begin with either a letter or an underscore(_) and can only contain letters, numbers, and underscores. Spaces are not allowed. If you wish to use a two or more word name, use either of these methods: $string_name or $StringName. And lastly, a $ must precede the name of the variable, to let PHP know you are using a variable.

    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

    - Viewing and Editing Tasks for a Project Mana...
    - More on Private Methods with PHP 5 Member Vi...
    - Adding Tasks to a Project Management Applica...
    - Utilizing Private Methods with PHP 5 and Mem...
    - Making Changes in a Project Management Appli...
    - Defining Public and Protected Methods with M...
    - HTML for a Project Management Application
    - Using Subclasses and Accessors with Member V...
    - Implementing Internet Protocols with PHP
    - Project Management: The Application
    - Working with Private Properties to Protect P...
    - Protecting PHP 5 Class Data with Member Visi...
    - Setting Up a Web-based Image Hosting Service
    - Comparing Files and Databases with PHP Bench...
    - Setting Up a Web-Based Image Gallery





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