PHP MYSQL - Operators - 5.7 Array Operators

 

PHP Array Operators

The PHP array operators are used to compare arrays.

OperatorNameExampleResult
+Union$x + $yUnion of $x and $y
==Equality$x == $yReturns true if $x and $y have the same key/value pairs
===Identity$x === $yReturns true if $x and $y have the same key/value pairs in the same order and of the same types
!=Inequality$x != $yReturns true if $x is not equal to $y
<>Inequality$x <> $yReturns true if $x is not equal to $y
!==Non-identity$x !== $yReturns true if $x is not identical to $y
<!DOCTYPE html>
<html>
<body>

<?php
$x = array("a" => "red", "b" => "green");  
$y = array("c" => "blue", "d" => "yellow");  

print_r($x + $y); // union of $x and $y
?>  

</body>
</html>

Output:
Array ( [a] => red [b] => green [c] => blue [d] => yellow )

Ex:2
<!DOCTYPE html>
<html>
<body>

<?php
$x = array("a" => "red", "b" => "green");  
$y = array("c" => "blue", "d" => "yellow");  

var_dump($x == $y);
?>  

</body>
</html>

Output:
bool(false)

Dear student try remain operators .

Popular posts from this blog

Install Windows 7 Operating System - Practical

COPA Bits for Computer Based Test (CBT) by Venugopal Vanjarapu

COPA