PHP
  Home arrow PHP arrow Page 4 - 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 - Working with Strings


    (Page 4 of 4 )

    Now that we know how to print a string and create variables to hold strings, let's look at some ways to manipulate strings.


    <html>

    <body>


    <?php

    $first_name = "James";

    $last_name = "Payne";


    echo $first_name . " " . $last_name; concatenation

    ?>


    </body>

    </html>

    The above code is called concatenation and is used to join two things together (in this case, two words). The above code prints out the text:

      James Payne

    You will note the " " places a space between the words.

    There are a ton of functions that let you goof around with strings in PHP, and I will write a tutorial on them in the near future.

    In addition to toying with strings, you can also manipulate numeric data as well. To do this we use operators. Below is a giant list of the different operators available to you in PHP.

     

    Symbol

    What it Does

    Type

    +

    Used for Addition

    Arithmetic

    -

    Used for Subtraction

    Arithmetic

    *

    Used for Multiplication

    Arithmetic

    /

    Used for Dividing

    Arithmetic

    %

    Used for Modulation

    Arithmetic

    ++

    Used to increase value by one

    Arithmetic

    --

    Used to decrease value by one

    Arithmetic

    "="

    Used to Assign a Value

    Comparison

    +=

    Used to Add and Assign a Value

    Comparison

    -=

    Used to Subtract and Assign a Value

    Comparison

    *=

    Used to Multiply and Assign a Value

    Comparison

    /=

    Used to Divide and Assign a Value

    Comparison

    .=

    Decimals and Adds a Value

    Comparison

    %=

    Used to Modulate and Add a Value

    Comparison

    "=="

    Equal To

    Comparison

    !=

    Not Equal To

    Comparison

    >

    Greater Than

    Comparison

    <

    Less Than

    Comparison

    >=

    Greater Than or Equal To

    Comparison

    <=

    Less Than or Equal To

    Comparison

    &&

    Checks for more than one criteria

    Logical

    ||

    Checks to see if at least one of a set of criteria is true

    Logical

    !

    Checks to see if a criteria is not true

    Logical

    Well that's all the time we have for this tutorial. In our next episode, we will discuss how to use the various operators to further manipulate our data. If we have time we discuss Conditional Statements as well.

    Till then...


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · 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 2 hosted by Hostway