πŸš€ DevOps & SRE Certification Program πŸ“… Starting: 1st of Every Month 🀝 +91 8409492687 πŸ” Contact@DevOpsSchool.com

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOpsSchool!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

How can use Array Operators in PHP with Example?

Php union:-
($a+$b) = Work as union means if same value then replace left variable to right variable(for keys that exit both array)
ex:-

<?php
$a = array ("value"=> 100, "value1"=> 200, "value2"=> 300, "value3"=> 400);
$b = array ("value"=> "name", "value1"=>"name1", "value2"=> "name3", "value3"=>"name4", "value4"=> "name5");
$sample = $a+$b;
print_r($sample);
//second example
echo "<br>";
$a = array ("value"=> 100, "value1"=> 200, "value2"=> 300, "value3"=> 400);
$b = array ("value"=> "name", "value1"=>"name1", "value2"=> "name3", "value3"=>"name4", "value4"=> "name5");
$sample = $b+$a;
print_r($sample);
?>
view raw union-operators.php hosted with ❀ by GitHub

Php Equality:-
Key value same but order different then print true.Key/Value pair different but order same then print false.
ex:-

<?php
//Php Equality
//True $c and $c have same key/value
echo "<br>";
$c = array ("value"=> 100, "value1"=> 200, "value2"=> 300, "value3"=> 400);
$d = array ("value"=> "name", "value1"=>"name1", "value2"=> "name3", "value3"=>"name4", "value4"=> "name5");
if ($c == $d)
{
echo "this is True operators";// Key value same but order different then print true
}
else
echo "this is False operators";//Key/Value pair different but order same then print false
//second example
echo "<br>";
$c = array ("value"=> 100, "value1"=> 200, "value2"=> 300, "value3"=> 400);
$d = array ("value1"=> 100, "value2"=> 200, "value3"=> 300, "value"=> 400);
if ($c == $d)
{
echo "this is True operators";// Both array Key/Value Pair True
}
else
echo "this is False else operators";//Key/value pair False
?>

Php Identity:-
In this Operators key/pair value same but order different then display false means order does not matter & when order same
ex:-

<?php
//Php Identity
echo "<br>";
$c = array ("value"=> 100, "value1"=> 200, "value2"=> 300, "value3"=> 400);
$d = array ("value1"=> 100, "value2"=> 200, "value3"=> 300, "value"=> 400);
if ($c === $d)
{
echo "this is True operators";// Both array Key/Value Pair True
}
else
echo "this is False operators";//Key/value pair False
//second example
echo "<br>";
$c = array ("value"=> 100, "value1"=> 200, "value2"=> 300, "value3"=> 400);
$d = array ("value"=> 100, "value1"=> 200, "value2"=> 300, "value3"=> 400);
if ($c === $d)
{
echo "this is True operators";// Both array Key/Value Pair True
}
else
echo "this is False operators";//Key/value pair False
//third exmple
echo "<br>";
$c = array ("value"=> 100, "value1"=> 200, "value2"=> 300, "value3"=> 400);
$d = array ("value"=> 200, "value1"=> 100, "value2"=> 400, "value3"=> 300);
if ($c === $d)
{
echo "this is True operators";// Both array Key/Value Pair True
}
else
echo "this is False operators";//Key/value pair False
?>

Certification Courses

DevOpsSchool has introduced a series of professional certification courses designed to enhance your skills and expertise in cutting-edge technologies and methodologies. Whether you are aiming to excel in development, security, or operations, these certifications provide a comprehensive learning experience. Explore the following programs:

DevOps Certification, SRE Certification, and DevSecOps Certification by DevOpsSchool

Explore our DevOps Certification, SRE Certification, and DevSecOps Certification programs at DevOpsSchool. Gain the expertise needed to excel in your career with hands-on training and globally recognized certifications.