After the two-dimensional array is combined, the key name of the two-dimensional array is 0, not a string.-php Tutorial

Source: Internet
Author: User
After the two-dimensional array is combined, the key name of the two-dimensional array is 0, not a string.
$ Arr = Array ([id] => 312355 [num] => 2231231 [url] => http://www.aba.com/add.php [name] => Forest [idNum] => 44090000000000 [pNum] => 18955501 [0] => Array ([cus] => aaa [amo] => 100 [fre] => 0 [Amount] => 100 [t] => 0 [me] => [Name] => ))


How to change the key name of $ arr [0] to $ arr ['AAA']


Reply to discussion (solution)

$arr['aaaa'] = $arr[0];unset($arr[0]);

Can you name it when merging?

It depends on how you merge it?
Or, it is written as aaa during merge.

Can you name it when merging?



Array_push ($ data, $ chiddenCI );
$ Data ['chiddenci'] = $ data [0];
Unset ($ data [0]);
Print_r ($ data );
It is merged through array_push.

You can use array_push to merge data.

Why?
Array_push ($ data, $ chiddenCI );

Just like this?
$ Data ['chiddenci'] = $ chiddenCI;

Why?
Array_push ($ data, $ chiddenCI );

Just like this?
$ Data ['chiddenci'] = $ chiddenCI;



Haha. yes. I am dizzy. it seems useless to sit and write code. I have to stand up and think about something.
Related Article

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.