How can I change the key name of an array to the key value of the second array if the array length is the same?

Source: Internet
Author: User
How to change the key name of an array to the key value of the second array when the array length is the same. For example, I have $ aa .... $ bb $ aaArray & nbsp; (0 & nbsp; & gt; cd, 1 & nbsp; & gt; udd, 2 & gt; dsd); $ bbArray & nbsp; (& nbsp; 0 & nbsp; & gt; & nbsp; 13ds, 1 & nbsp; & gt; the length of the tdfe array is the same, how to change the key name of an array to the key value of the second array.
For example, I have $ aa... $ bb

$ Aa = Array ("0" => "cd", "1" => "udd", "2" => "dsd ");
$ Bb = Array ("0" => 13ds, "1" => "tdfestsdfa1", "2" => "1122sdfdsasdf33abc ");
Convert the key name of the $ aa array to the key value of the second array $ bb.

How to form the following array ¥ cc.

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

Please kindly advise.
------ Solution ----------------------
$aa = Array("0" => "cd", "1" => "udd","2" => "dsd");
$bb = Array("0" => "13ds", "1" => "tdfestsdfa1", "2" => "1122sdfdsasdf33abc");
$cc = array_combine($aa, $bb);
print_r($cc);
$aa = Array("0" => "cd", "1" => "udd","2" => "dsd");
$bb = Array("0" => "13ds", "1" => "tdfestsdfa1", "2" => "1122sdfdsasdf33abc");
$cc = array_combine($aa, $bb);
print_r($cc);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.