array_diff()
functionYou can use the PHP array_diff()
function to compare an array against one or more other arrays.
The array_diff()
function returns the values in the first array that are not present in any of the other arrays. Let's try out an example to understand how it actually works:
<?php
$array1 = array("a" => "sky", "star", "moon", "cloud", "moon");
$array2 = array("b" => "sky", "sun", "moon");
// Comparing the values
$result = array_diff($array1, $array2);
print_r($result);
?>
Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]
How to create custom 404 page in laravel
In this tutorials, i am showing to how t...How to Delete an Element from an Array in PHP
Use the PHP unset() Function If you w...10 basic commands that every regular Linux users need to know Part 2
In the previous article, we have di...Using the $loop variable in foreach loops in Laravel Blade
Laravel provides simple blade template w...How to pass data from PHP to JavaScript
PHP is server side language which retrie...