PHP
  Home arrow PHP arrow Page 2 - PHP Operators
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 
Moblin 
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

PHP Operators
By: James Payne
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 18
    2007-10-31

    Table of Contents:
  • PHP Operators
  • Assignment Operators
  • Arithmetic Operators
  • Incremental Operators
  • Better by Comparison
  • Logical Operators

  • 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

    Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!

    PHP Operators - Assignment Operators


    (Page 2 of 6 )

    We've already worked briefly with one of the assignment operators. Their basic function is to assign a value to a variable.


    <html>

    <body>


    <?php

    $example_variable = “An example”;

    $number_variable = 1;


    ?>


    </body>

    </html>

    Spark your memory? In addition to using the = operator, you can also add a value to your variable and reassign it the new value. Like this:


    <html>

    <body>


    <?php

    $initial_value = 10;

    $initial_value +=;


    ?>


    </body>

    </html>

    In the above example the variable $initial_value is set to 10. Then we take the value of $initial_value and add it to itself. The line $initial_value += is the same as writing $initial_value + $initial_value. Since the value is originally set at 10, the value is now 20.

    It works the same with the rest of the assignment operators. If you had used the *= operator, it would have multiplied $initial_value by itself and resulted in the new value of 100.

    More PHP Articles
    More By James Payne


       · Hey thanks for taking the time to read my article on PHP Operators- I hope it was...
       · . . . but, if I remember Correctly, it's Sisko, not Cisco. And Archer is way...
       · I don't recall if it is in PHP4, but the === operator can be quite valuable.
       · Don't you need some backslashes and an ending quote?echo "<h1...
     

       

    PHP ARTICLES

    - Handling Attachments in MIME Email with PHP
    - Completing the Project Management Application
    - Sending MIME Email with PHP
    - Handling Files for a Project Management Appl...
    - 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...




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