PHP array_diff() Function Example

PHP Script:



$arr3 = array("CE","EE","TE");
$arr4 = array("EE","BE","ME");
$arr5 = array("IM","TE","ME");



[b] => Lion
[c] => Tiger
[d] => Cat
[0] => CE


PHP array_diff() function is used to compare the values of two or more arrays and returns the differences as an array which contains the elements from an Array1 that are not present in other arrays.

PHP array_diff() function parameters:

1- Array1 (required)
2- Array2 (required)
3- Array3 (optional)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s