Results 1 to 6 of 6

Thread: How to use an Operators in PHP?

  1. #1
    Join Date
    Apr 2009
    Posts
    487

    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?

  2. #2
    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.

  3. #3
    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) @
    • !
    • * /%
    • + -.
    • <<>>
    • <<=>> = <>
    • ==! = ===! ==
    • = + = -= *= / = .=% = & = | = ^ = <<=>> =
    • & &

  4. #4
    Join Date
    Oct 2005
    Posts
    2,393

    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.

  5. #5
    Join Date
    May 2008
    Posts
    2,297

    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.

  6. #6
    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 @.

Similar Threads

  1. php operators and keywords
    By Fragman in forum Software Development
    Replies: 5
    Last Post: 26-02-2010, 06:15 PM
  2. What are the Operators and Expressions in C# ?
    By kyosang in forum Software Development
    Replies: 4
    Last Post: 09-02-2010, 06:32 AM
  3. overloading of operators in C++
    By shilong in forum Software Development
    Replies: 3
    Last Post: 28-01-2009, 10:30 PM
  4. Using new and delete Operators in C++
    By Rahul45 in forum Software Development
    Replies: 1
    Last Post: 10-12-2008, 01:31 PM
  5. Want info on C# Operators
    By ashwinK in forum Software Development
    Replies: 2
    Last Post: 03-11-2008, 02:31 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,716,958,668.42510 seconds with 17 queries