php array_intersect_ukey()函數使用方法

來源:互聯網
上載者:User

好了下面我們來看看php array_intersect_ukey()函數使用方法與執行個體教程吧.

array_intersect_ukey()定義和用法
該array_intersect_ukey ( )函數比較的鑰匙在兩個或兩個以上的陣列,檢查比賽之前,比較的鑰匙在一個使用者定義的函數,然後返回一個數組的項和值從第一個數組,如果該功能允許它。

文法

array_intersect_ukey(array1,array2,array3...,function)
  
Parameter Description
array1 Required. The first array is the array that the others will be compared with
array2 Required. An array to be compared with the first array
array3 Optional. An array to be compared with the first array
function Required. The name of the user-made function
  

提示和說明
提示:您可以比較的第一個陣列一個陣列,或有你喜歡。

注意:只有鑰匙必須同時獲得一場比賽,無論是在自動對比和使用者定義的函數。




範例1

 

<?phpfunction myfunction($v1,$v2) {if ($v1===$v2){return 0;}if ($v1>$v2){return 1;}else{return -1;}}$a1=array(0=>"Dog",1=>"Cat",2=>"Horse");$a2=array(3=>"Rat",1=>"Bird",5=>"Monkey");print_r(array_intersect_ukey($a1,$a2,"myfunction"));?>
輸出結果.
 
Array ( [] => Cat )

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.