Array reorganization, urgent

Source: Internet
Author: User
Array reorganization, urgent Array
(
[0] => trademark name
[1] => Yao Li's life
[2] => Registration No./Application No.
[3] = & gt; 4576058
[4] => International Classification
[5] => 25
[6] => application date
[7] => 2005/4/1
[8] => applicant name (Chinese)
[9] => Shi nengbo
[10] => requester address (Chinese)
[11] => No. 155, Yinglong Middle Road, inlin town, Jinjiang city, Fujian province
[12] => applicant name (English)
[13] =>
[14] => requester address (English)
[15] =>
[16] => trademark images
[17] =>
[18] => Similar groups
[19] = & gt; 2501 2507 2508
[20] => Product Service list
[21] => clothing, shoes, shirts, underwear, trousers, hats, leather clothing, skirts, clothes, bras;
[22] => preliminary review Announcement No.
[23] = & gt; 1135
[24] => Register the announcement date
[25] = & gt; 1147
)
How to reorganize an array like this:
Array
(
[Trademark name] => Yao Li Life
[Registration No./application no.] => 4576058
[International classification number] => 25
[Application date] => 2005/4/1
[Applicant name (Chinese)] => Shi nengbo
[Applicant address (Chinese)] => No. 155, Yinglong Middle Road, inlin town, Jinjiang city, Fujian province
[Applicant name (English)] =>
[Requester address (English)] =>
[Trademark images] =>
[Similar group] => 2501 2507 2508
[Product service list] => clothing, shoes, shirts, underwear, trousers, hats, leather clothing, skirts, clothes, bras;
[Preliminary review Announcement No.] => 1135
[Registration announcement date] => 1147
)
Can this problem be implemented? Can I post the source code? thank you very much !!!!!


Reply to discussion (solution)

$ A = array (0 => 'trademark name', 1 => 'Lili life', 2 => 'registration No./application no. ', 3 => '123 ', 4 => 'International Classification classification number ', 5 => '25', 6 => 'application date', 7 => '2014/1 ', 8 => 'applicant name (Chinese) ', 9 => 'Shi nengbo', 10 => 'applicant address (Chinese )', 11 => 'no. 155, inlong Middle Road, inlin town, Jinjiang city, Fujian province ', 12 => 'requester name (English)', 13 => ', 14 =>' requester address (English) ', 15 => '', 16 => 'trademark image', 17 =>'', 18 => 'similar group', 19 => '2017 2501 2507 ', 20 => 'product service list', 21 => 'clothing; shoes; shirts; underwear; trousers; hats; leather clothing; skirts; underwear; bus ', 22 => 'preliminary review announcement no. ', 23 => '123', 24 => 'registration announcement no.', 25 => '123 ',); foreach (array_chunk ($ a, 2) as $ v) $ res [$ v [0] = $ v [1]; print_r ($ res );
Array
(
[Trademark name] => Yao Li Life
[Registration No./application no.] => 4576058
[International classification number] => 25
[Application date] => 2005/4/1
[Applicant name (Chinese)] => Shi nengbo
[Applicant address (Chinese)] => No. 155, Yinglong Middle Road, inlin town, Jinjiang city, Fujian province
[Applicant name (English)] =>
[Requester address (English)] =>
[Trademark images] =>
[Similar group] => 2501 2507 2508
[Product service list] => clothing, shoes, shirts, underwear, trousers, hats, leather clothing, skirts, clothes, bras
[Preliminary review Announcement No.] => 1135
[Registration announcement date] => 1147
)

$ Arr = array (0 => 'trademark name', 1 => 'Lili life', 2 => 'registration number/application no. ', 3 => '123 ', 4 => 'International Classification classification number ', 5 => '25', 6 => 'application date', 7 => '2014/1 ', 8 => 'applicant name (Chinese) ', 9 => 'Shi nengbo', 10 => 'applicant address (Chinese )', 11 => 'no. 155, inlong Middle Road, inlin town, Jinjiang city, Fujian province ', 12 => 'requester name (English)', 13 => "", 14 => 'requester address (English) ', 15 => "", 16 => 'trademark image', 17 => "", 18 => 'similar group', 19 => '2017 2501 2507 ', 20 => 'product service list', 21 => 'clothing; shoes; shirts; underwear; trousers; hats; leather clothing; skirts; suits; bras ;', 22 => 'preliminary review announcement no. ', 23 => '123', 24 => 'registration announcement no.', 25 => '123 '); $ newArr = array_chunk ($ arr, 2); $ a = array_map ('mkarr', $ newArr); function mkArr ($ n) {return array ($ n [0] =>n n [1]);} var_dump ($ );

$out = array();$newArr = array_chunk ( $arr ,  2 );foreach ($newArr as $key => $value) {$out[$value[0]] = $value[1];}var_dump($out);

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.