"cd","1" =>"udd","2"=>"dsd");$bb=Array ( "0" => 13ds,"1" =>"tdfe"/> "cd","1" =>"udd","2"=>"dsd");$bb=Array ( "0" => 13ds,"1" =>"tdfe">

数组长度相同,怎么把一个数组的键名变成第二个数组的键值

WBOY
發布: 2016-06-13 12:09:55
原創
1068 人瀏覽過

数组长度相同,如何把一个数组的键名变成第二个数组的键值。
比如我有$aa....$bb

$aa=Array ("0" =>"cd","1" =>"udd","2"=>"dsd");
$bb=Array ( "0" => 13ds,"1" =>"tdfestsdfa1","2" => "1122sdfdsasdf33abc") ;
把$aa数组的键名变成第二个数组$bb的键值。

如何形成如下数组¥cc。

$cc=Array ( "cd" => 13ds,"udd" =>"tdfestsdfa1","dsd" => "1122sdfdsasdf33abc") ;

请高人指点。
------解决思路----------------------

$aa = Array("0" => "cd", "1" => "udd","2" => "dsd");<br />$bb = Array("0" => "13ds", "1" => "tdfestsdfa1", "2" => "1122sdfdsasdf33abc");<br />$cc = array_combine($aa, $bb);<br />print_r($cc);
登入後複製
$aa = Array("0" => "cd", "1" => "udd","2" => "dsd");<br />$bb = Array("0" => "13ds", "1" => "tdfestsdfa1", "2" => "1122sdfdsasdf33abc");<br />$cc = array_combine($aa, $bb);<br />print_r($cc);
登入後複製

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板