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 ! My name is Rahul Kumar Rajput. I'm a back end web developer and founder of learnhindituts.com. I live in Uttar Pradesh (UP), India and I love to talk about programming as well as writing technical tutorials and tips that can help to others.
Get connected with me. :) LinkedIn Twitter Instagram Facebook