PHP array_udiff_uassoc() ফাংশন

ইনস্ট্যান্স

দুই এলাকার কী নাম এবং কী মানকে তুলনা করে (ব্যবহারকারী-নির্দিষ্ট ফাংশন ব্যবহার করে), এবং একটি ফাংশন ফলাফল প্রদান করে:

<?php
function myfunction_key($a,$b)
{
if ($a===$b)
  {
  return 0;
  }
  return ($a>$b)?1:-1;
}
function myfunction_value($a,$b)
{
if ($a===$b)
  {
  return 0;
  }
  return ($a>$b)?1:-1;
}
$a1=array("a"=>"red","b"=>"green","c"=>"blue");
$a2=array("a"=>"red","b"=>"green","c"=>"green");
$result=array_udiff_uassoc($a1,$a2,"myfunction_key","myfunction_value");
print_r($result);
?>

চলতি ইনস্ট্যান্স

সংজ্ঞা ও ব্যবহার

array_udiff_uassoc() ফাংশন দুই (বা আরও বেশি) এলাকার কী নাম এবং কী মানকে তুলনা করে এবং একটি ফাংশন ফলাফল প্রদান করে

মন্তব্য:এই ফাংশন দুই ব্যবহারকারী-নির্দিষ্ট ফাংশন ব্যবহার করে; প্রথম ফাংশন কী নামকে তুলনা করে, দ্বিতীয় ফাংশন কী মানকে তুলনা করে!

এই ফাংশন দুই (বা আরও বেশি) এলাকার কী নাম এবং কী মানকে তুলনা করে এবং একটি ফাংশন ফলাফল প্রদান করে, যা তুলনার জন্য এলাকা (array1in, but not in any other parameter array (array2 or array3 etc.) key names and key values.

ব্যাখ্যা

array_udiff_uassoc() ফাংশন ফলাফল প্রদান করে array1 যেখানে একটি এলাকায় বিদ্যমান কিন্তু অন্য এলাকায় নেই তা উপস্থাপিত হয়। ফলাফলস্বরূপ এলাকায় কী নামটি অব্যাহত থাকে。

মন দিনো, array_diff() এবং array_udiff() ভিন্ন হল কী নামটিকেও তুলনার জন্য ব্যবহার করা হয়। একইসঙ্গে কী নাম এবং কী মানকেও তুলনা করা হয়, যেমন "a"=>1 এবং "b"=>1 এই দুটি তত্ত্ব একই নয়।

কী নাম (সূচক) এর পরীক্ষা করা হয় কলব্যাকসন ফাংশনের দ্বারা myfunction_key এটা হলেন। এটা অন্য কিছুর সাথে array_udiff_assoc() behave differently, the latter is compared using internal functions to compare indices.

Array data comparison is performed using the callback function provided by the user myfunction_value is carried out. In this respect and array_diff_assoc() behave exactly the opposite, the latter is compared using internal functions.

Both functions have two parameters to be compared. If the first parameter is less than the second parameter, the function returns a negative number, if the two parameters are equal, the return value should be 0, and if the first parameter is greater than the second, the return value should be a positive number.

Syntax

array_udiff_uassoc(array1,array2,array3...myfunction_key,myfunction_value)
Parameters Description
array1 Required. The first array to be compared with other arrays.
array2 Required. The array to be compared with the first array.
array3,... Optional. Other arrays to be compared with the first array.
myfunction_key

Required. The name of the user-defined function used to compare array keys.

String value, defines the callable comparison function. If the first parameter is less than or equal to or greater than the second parameter, the comparison function must return an integer less than or equal to or greater than 0.

myfunction_value

Required. The name of the user-defined function used to compare array values.

String value, defines the callable comparison function. If the first parameter is less than or equal to or greater than the second parameter, the comparison function must return an integer less than or equal to or greater than 0.

Technical Details

Return Value: Returns an array of differences, which includes all the elements in the compared arrays (array1in, but not in any other parameter array (array2 or array3 etc.) key names and key values.
PHP Version: 5+