Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 05-03-2010
Member
 
Join Date: Apr 2009
Posts: 482
How to use an Operators in PHP?

Hello friends,
I am new to the PHP programming language. I have used an operators in different programming language but now I want to use it in PHP. Since, I don't know anything about the PHP, I am not even tried using it. So thought to post here, since you guys explain very clearly. Please tell me how to use an Operators in PHP?
Reply With Quote
  #2  
Old 05-03-2010
Member
 
Join Date: Mar 2008
Posts: 349
Re: How to use an Operators in PHP?

There are three types of operators. First, the unary operator which operates on a single value, for example! (the negation operator) or + + (the increment). The second group are termed binary operators; and The third group is the ternary operator:?:. They must be used to select between two expressions depending on a third, rather than to select two sentences or paths of execution. Surrounding ternary expressions with parentheses are a very good idea.
Reply With Quote
  #3  
Old 05-03-2010
Member
 
Join Date: Mar 2008
Posts: 672
Re: How to use an Operators in PHP?

The following are the Operator Precedence :
  • new clone
  • + + --
  • ~ - (Int) (float) (string) (array) (object) (bool) @
  • !
  • * /%
  • + -.
  • <<>>
  • <<=>> = <>
  • ==! = ===! ==
  • = + = -= *= / = .=% = & = | = ^ = <<=>> =
  • & &
Reply With Quote
  #4  
Old 05-03-2010
Member
 
Join Date: Oct 2005
Posts: 2,389
Re: How to use an Operators in PHP?

You should also know about the Assignment Operators, since they are very commonly used in operators. The assignment operator is the simplest sign "=". The first instinct is to think that this sign means "equal to". This is not the case. It means that the left operand gets set to the value of the expression is the right of the equals sign. The value of an assignment expression is the value assigned. In addition to the basic assignment operator, there are "combined operators" for all operators arithmetic, array union and operators on strings. This allows to use the value of a variable in an expression and affect the outcome of this expression to that variable.
Reply With Quote
  #5  
Old 05-03-2010
Member
 
Join Date: May 2008
Posts: 2,293
Re: How to use an Operators in PHP?

Comparison operators, as their name implies, allow you to compare two values. You should also be interested in the comparison tables of types, because they show examples of many types of comparisons :
  • Equal - TRUE if $a is equal to $b.
  • Identical - TRUE if $a is equal to $b, and they are of the same type.
  • Not equal - TRUE if $a is not equal to $b.
  • Less than - TRUE if $a is strictly less than $b.
  • Greater than - TRUE if $a is strictly greater than $b.
  • Less than or equal to - TRUE if $a is less than or equal to $b.
  • Greater than or equal to - TRUE if $a is greater than or equal to $b.
Reply With Quote
  #6  
Old 05-03-2010
Member
 
Join Date: Apr 2008
Posts: 1,948
Re: How to use an Operators in PHP?

PHP supports a control operator error: @ it. When this operator is prepended to an expression PHP error messages that may be generated by that expression will be ignored. If the option track_errors is enabled, error messages generated by the expression will be saved in the global variable $ php_errormsg. This variable will be overwritten on each error. It must then be monitored often to use it. The @-operator works only on expressions. The rule of thumb is: if you can take the value of something, you can prepend the @.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to use an Operators in PHP?"
Thread Thread Starter Forum Replies Last Post
php operators and keywords Fragman Software Development 5 26-02-2010 06:15 PM
What are the Operators and Expressions in C# ? kyosang Software Development 4 09-02-2010 06:32 AM
overloading of operators in C++ shilong Software Development 3 28-01-2009 10:30 PM
Using new and delete Operators in C++ Rahul45 Software Development 1 10-12-2008 01:31 PM
Want info on C# Operators ashwinK Software Development 2 03-11-2008 02:31 PM


All times are GMT +5.5. The time now is 01:02 PM.