PHP array_intersect_ukey() ফাংশন
উদাহরণ
কীয়ের মান তুলনা করে (ব্যবহারকারীর নিজস্ব ফাংশন দ্বারা কীয়ের মান তুলনা করে), এবং আইন্টারফেস ফিরিয়ে দেয়:
<?php function myfunction($a,$b) { if ($a===$b) { return 0; } return ($a>$b)?1:-1; } $a1=array("a"=>"red","b"=>"green","c"=>"blue"); $a2=array("a"=>"blue","b"=>"black","e"=>"blue"); $result=array_intersect_ukey($a1,$a2,"myfunction"); print_r($result); ?>
সংজ্ঞা ও ব্যবহার
array_intersect_ukey() ফাংশন দুই (বা আরও বেশি) আইন্টারফেস কীয়ের মান তুলনা করে, এবং তুলনা করা আইন্টারফেসগুলির মধ্যে সমান কীয়ের মান ফিরিয়ে দেয়
মন্তব্য:এই ফাংশন ব্যবহারকারীর নিজস্ব ফাংশন দ্বারা কীয়ের মান তুলনা করে!
এই ফাংশন দুই (বা আরও বেশি) আইন্টারফেস কীয়ের মান তুলনা করে, এবং তুলনা করা আইন্টারফেসগুলির মধ্যে সমান কীয়ের মান ফিরিয়ে দেয়array1)中,and also in any other parameter array(array2 or array3 etc.) key names.
ব্যাখ্যা
array_intersect_ukey() ফাংশন কীয়ের মান তুলনা করতে কলব্যাক ফাংশন ব্যবহার করে আইন্টারফেস গণনা করে
array_intersect_ukey() ফাংশন একটি আইন্টারফেস ফিরিয়ে দেয়, যা সমস্ত উপস্থিত হওয়ার চেয়ে সমস্ত পারামিটার আইন্টারফেসে উপস্থিত array1 এবং সমস্ত অন্যান্য পারামিটার আইন্টারফেসে সময়ের সাথে উপস্থিত কীয়ের মান
এই তুলনা ব্যবহারকারী দ্বারা প্রদত্ত রিটার্ন ফাংশন দ্বারা করা হয়। এই ফাংশন দুই পারামিটার নিয়ে আসে, যা তুলনা করতে হবে। যদি প্রথম পারামিটার দ্বিতীয় পারামিটারের চেয়ে কম, তবে ফাংশন একটি নেতিবাচক সংখ্যা ফিরিয়ে দেবে, যদি দুই পারামিটার সমান, তবে 0 ফিরিয়ে দেবে, যদি প্রথম পারামিটার দ্বিতীয় পারামিটারের চেয়ে বেশি, তবে একটি নেতিবাচক সংখ্যা ফিরিয়ে দেবে。
গণিত
array_intersect_ukey(array1,array2,array3...myfunction)
Parameter | Description |
---|---|
array1 | Required. The first array to compare with other arrays. |
array2 | Required. The array to compare with the first array. |
array3,... | Optional. Other arrays to compare with the first array. |
myfunction | Required. Define a string that specifies the callable comparison function. If the first parameter is less than, equal to, or greater than the second parameter, the comparison function must return an integer less than, equal to, or greater than 0. |
Technical Details
Return Value: | Returns an intersection array that includes all the key names in the compared arrays(array1)中,and also in any other parameter array(array2 or array3 etc.) key names. |
PHP Version: | 5.1.0+ |
More Examples
Example 1
Compare the key names of three arrays (using a user-defined function to compare key names) and return the intersection:
<?php function myfunction($a,$b) { if ($a===$b) { return 0; } return ($a>$b)?1:-1; } $a1=array("a"=>"red","b"=>"green","c"=>"blue"); $a2=array("a"=>"black","b"=>"yellow","d"=>"brown"); $a3=array("e"=>"purple","f"=>"white","a"=>"gold"); $result=array_intersect_ukey($a1,$a2,$a3,"myfunction"); print_r($result); ?>