PHP array_uintersect_uassoc() လုပ်ဆောင်ချက်
ဥပမာ
Array နှစ်ခု၏ သော့များနှင့် တန်ဖိုးများ ကို နှိုင်း ယှဉ်ပါ (နှိုင်းယှဉ်မှုအတွက် အသုံးပြုသူသတ်မှတ်ထားသော လုပ်ဆောင်ချက်နှစ်ခုကို အသုံးပြု၍) နှင့် ကိုက်ညီမှုများကို ပြန်ပေးသည်-
<?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_uintersect_uassoc($a1,$a2,"myfunction_key","myfunction_value");
print_r($result);
?>
အဓိပ္ပါယ်နှင့် အသုံးပြုမှု
array_uintersect_uassoc() လုပ်ဆောင်ချက် သည် နှစ်ခု သို့မဟုတ် ထို့ထက်ပိုသော array များ၏ သော့များနှင့် တန်ဖိုးများ ကို နှိုင်းယှဉ် ပြီး ကိုက်ညီမှုများကို ပြန်ပေးသည်။
မှတ်ချက်- ဤလုပ်ဆောင်ချက်သည် နှိုင်းယှဉ်ရန်အတွက် အသုံးပြုသူသတ်မှတ်ထားသော လုပ်ဆောင်ချက် နှစ်ခုကို အသုံးပြုသည်။ သော့ကို ပထမလုပ်ဆောင်ချက်တွင် အသုံးပြုပြီး ဒုတိယတန်ဖိုးကို အသုံးပြုသည်။
ဤလုပ်ဆောင်ချက်သည် array နှစ်ခု (သို့မဟုတ် ထို့ထက်ပိုသော) array များ၏ သော့များနှင့် တန်ဖိုးများကို နှိုင်းယှဉ်ပြီး array1 မှ entry များ ပါရှိသော array1 မှ array 2, array3, etc.
အထားအသို
array_uintersect_uassoc(array1, array2, array3, ..., myfunc_key, myfunc_value)
ကန့်သတ်တန်ဖိုးများ
Parameter | Description |
---|---|
array1 | Required. The array to compare from |
array2 | Required. An array to compare against |
array3,... | Optional. More arrays to compare against |
myfunc_key | Required. The name of the user-defined function that compares
the array keys. A string that define a callable comparison function. The comparison function must return an integer <, =, or > than 0 if the first argument is <, =, or > than the second argument |
myfunc_value | Required. The name of the user-defined function that compares
the array values. A string that define a callable comparison function. The comparison function must return an integer <, =, or > than 0 if the first argument is <, =, or > than the second argument. |
နည်းပညာဆိုင်ရာအသေးစိတ်
ပြန်ပို့တန်ဖိုး- | အခြား array များအားလုံးတွင် ရှိနေသည့် array1 မှ ထည့်သွင်းမှုများပါရှိသော array တစ်ခုကို ပြန်ပေးသည် |
---|---|
PHP ဗားရှင်း- | ၅+ |
❮ PHP Array အကိုးအကား