Comparing Arrays in PHP PRO

PHP allows us to compare two arrays using the == and the === operators. The following code sample together with the video clip that follows explain the way each one of these two operators work.

<?php
//$a = ['a'=>'avodado','b'=>'bamba','c'=>'calco'];
//$b = ['b'=>'bamba','a'=>'avodado','c'=>'calco'];
$a = [123,455,323];
$b = [323,123,455];
if($a==$b)
{
	echo "a and b equal";
}
else
{
	echo "a and b not equal";
}
?>

The following video clip explains how each one of the two operators (== and ===) work when comparing two arrays.

Share:

The Visitor Design Pattern

The Visitor Design Pattern

The visitor design pattern allows us to add operations to objects that already exist without modifying their classes and without extending them.

What are Anti Patterns?

Anti Patterns

Unlike design patterns, anti patterns just seem to be a solution. However, they are not a solution and they cause additional costs.

Virtual Threads in Java Professional Seminar

Virtual Threads in Java

The use of virtual threads can assist us with improving the performance of our code. Learn how to use virtual threads effectively.

The Beauty of Code

Coding is Art! Developing Code That Works is Simple. Develop Code with Style is a Challenge!

Update cookies preferences