logo
g Text Version
Beauty & Self
Books & Music
Career
Computers
Education
Family
Food & Wine
Health & Fitness
Hobbies & Crafts
Home & Garden
Money
News & Politics
Relationships
Religion & Spirituality
Sports
Travel & Culture
TV & Movies

dailyclick
Bored? Games!
Nutrition
Postcards
Take a Quiz
Rate My Photo

new
European Travel
Action Movies
Bible Basics
Houseplants
Romance Movies
Creativity
Family Travel


dailyclick
All times in EST

Autism Spectrum Disorders: 4:00 PM

Full Schedule
g
g PHP Site

BellaOnline's PHP Editor

g

PHP Operators

Guest Author - Diane Cipollo

In this tutorial we will discuss the PHP operators and how they are used. There are five types of PHP operators; the assignment, arithmetic, comparison, logical and increment/decrement operators.
  • Assignment Operators
    The assignment operators are used to assign a value to a PHP variable. For example I might want to assign the value of Diane to a variable named $MyName. There are four assignment operators.

    = This assigns a value to the variable named $no

    $no = 1;
    += This assigns the value of $no +1 to the variable named $no

    $no += 1;
    = This assigns the value of $no -1 to the variable named $no

    $no = 1;
    .= This concatenates (adds to) two values together. In the example below I am adding the value of " Cipollo" to the $MyName variable. Remember that the value of $MyName is Diane.

    $MyName .= " Cipollo";

    Now the value of $MyName is Diane Cipollo.


  • Arithmetic Operators
    There are five PHP arithmetic operators. But don't panic. It's just basic math.

    + addition

    This adds two values together.

    $c = $a + $b;
    subtraction

    This subtracts one value from another value.

    $c = $a - $b;
    * multiplication

    This multiplies two values.

    $c = $a * $b;
    / division

    This divides two values.

    $c = $a / $b;
    % modulus or remainder

    This gives the remainder of two values.

    $c = $a % $b;

    Let's say the value of $a is 7 and the value of $b is 5. Then the value of $c would be the remainder which is 2.
Next →




This site needs an editor - click to learn more!

Add PHP+Operators to Twitter Add PHP+Operators to Facebook Add PHP+Operators to MySpace Add PHP+Operators to Del.icio.us Digg PHP+Operators Add PHP+Operators to Yahoo My Web Add PHP+Operators to Google Bookmarks Add PHP+Operators to Stumbleupon Add PHP+Operators to Reddit




RSS | Editor's Picks Articles | Top Ten Articles | Previous Features | Site Map


For FREE email updates, subscribe to the PHP Newsletter


Past Issues


print
Printer Friendly
bookmark
Bookmark
tell friend
Tell a Friend
forum
Forum
email
Email Editor


Content copyright © 2014 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.

g


g features
Archives | Site Map

forum
Forum
email
Contact

Past Issues
memberscenter


vote
Poetry
Daily
Weekly
Monthly
Less than Monthly



BellaOnline on Facebook
g


| About BellaOnline | Privacy Policy | Advertising | Become an Editor |
Website copyright © 2014 Minerva WebWorks LLC. All rights reserved.


BellaOnline Editor