If tutorials available on this website are helpful for you, please whitelist this website in your ad blocker😭 or Donate to help us ❤️ pay for the web hosting to keep the website running.
array_diff() method , दो या दो से अधिक Arrays का difference return करता है। method में पहले pass किये गए Array के वो elements return करता है जो बाकी Array(s) में नहीं हैं।
array_diff ( array $array , array ...$arrays );
$array | required : Array variable जिसे बाकी Array(s) से compare करना है।
...$arrays | required : Array variables जिन्हे पहले Array से compare करना है , आप कितने ही Array(s) pass कर सकते हैं। लेकिन काम से काम 1 तो pass करना ही पड़ेगा।
File : php_array_diff.php
<?php
$array1 = array("a" => "green", "red", "blue", "red");
$array2 = array("b" => "green", "yellow", "red");
$result = array_diff($array1, $array2);
print_r($result);
?>
Array ( [1] => blue )
Hi ! I'm Rahul Kumar Rajput founder of learnhindituts.com. I'm a software developer having more than 4 years of experience. I love to talk about programming as well as writing technical tutorials and blogs that can help to others. I'm here to help you navigate the coding cosmos and turn your ideas into reality, keep coding, keep learning :)
Get connected with me. :) LinkedIn Twitter Instagram Facebook