Home PHP Ajax Regex Interviews Contact us    

PHP


Interview Questions


Array Operators

operatorsNameResult
$a + $bUnionUnion of $a and $b.
$a == $bEqualityTRUE  if $a and $b have the same key/value pairs.
$a === $bIdentityTRUE  if $a and $b have the same key/value pairs in the same order and of the same types.
$a != $bInequalityTRUE if $a is not equal to $b.
$a <> $bInequalityTRUE  if $a is not equal to $b.
$a !== $bNon-identityTRUE  if $a is not identical to $b.

String Operators

There are two string operators. The first is the concatanation operator ('.'), which returns the concatenation of its right and left arguments.

The second is the concatenating assignment operator ('.='), which appends the argument on the right side to the argument on the left side.

Error Control Operators

PHP supports one error control operator: the at sign (@). When prepended to an expression in PHP, any error messages that might be generated by that expression will be ignored.

Eg :- @file ('non_existent_file');

Execution Operators

PHP supports one execution operator : backticks (``).

Incrementing/Decrementing Operators

PHP supports C-style pre- and post-increment and decrement operators.

OperatorNameEffect
++$aPre-incrementIncrements $a by one, then returns $a.
$a++Post-incrementReturns $a, then increments $a by one.
--$aPre-decrementDecrements $a by one, then returns $a.
$a--Post-decrementReturns $a, then decrements $a by one.

Examples

<?php
    $var= 5 + 5; // 10
    
$var = 5 - 5; // 0
    
$var = 5 + 5 - (5 + 5); // 0
    
$var = 5 * 5; // 25
    
$var = 10 * 5 - 5; // 45

Modulus
for ($i = 1; $i <= 10; $i++) {
   if(($i % 2) == 1) //odd
      {echo $i."is odd number";}
   else //even
      {echo $i."is even number";}
}

?>


Feed Back of this Topic
 
Name :
Email :
Topic :
Comments :

Ajax


Regular Expression


 
Copyright © 2007 123developers.com
Contact us | Disclaimer