PHP
  Home arrow PHP arrow Page 6 - 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

    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

    PHP Operators - Logical Operators


    (Page 6 of 6 )

    Logical operators are used to help test one or more criteria. The && operator says: if this and this are true, then do this. The || operator says: if this criteria OR that criteria is true, then do this. And finally the ! operator checks to see if a value is NOT true.

    Oops I Did It Again

    One thing I neglected to cover in the previous article was the use of quotes when using the echo function. This caused me to be beaten with many whips and locked in the basement with only episodes of Ugly Betty to keep me company. I know. I still haven't recovered.

    When mixing HTML and PHP together be sure to follow these rules:


    • Do not use quotes inside of a string

    • Use the backslash to escape your quotes within a string

    • Use the single quote

    • Never feed them after midnight

    Here is an example:


    <html>

    <body>


    <?php


    echo “<h1 class=”yourH1”>Hello Fatty Boom Balatty</h1>;

    echo “<h1 class='yourH1'>Hello Fatty Boom Balatty</h1>


    ?>


    </body>

    </html>

    Both of the above are good examples of how to use quotes when mixing PHP and HTML.

    Well, we covered a lot of ground this episode. Hopefully you have a decent grasp of how operators work. Don't worry if you aren't a master of them yet; that comes with practice.

    In our next tutorial we will discuss the various Statements available in PHP and go more in-depth on the comparison and logical operators. So check back in. You might learn something.

    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 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 3 hosted by Hostway