What is the way to change the first subscript of an array, and use Dump () to print out a new subscript. Code the following workaround

Source: Internet
Author: User
What is the way to change the first subscript of an array, and use Dump () to print out a new subscript. The code is as follows
PHP Code
  
   Array (  1 = = Array (    0 = = Array (      ' created ' = = integer 1332383287      ' updated ' = = integer 1332385146      ' id ' = ' + String ' (length=2)      ' level ' = = '      tag_id ' = ' 1 '      status ' = = integer 0      ' creator_uid ' = = integer 6      ' assign_uid ' = = integer 6      ' assign_history ' = = String ' |6| | 6|6| ' (length=8)      ' Title ' = = String ' [iBay365] ' (length=10)      ' context ' = = String '))                 //requirement is "1 = = Array (0=> , Array (...)) " This 1 becomes php or Ajax text, and then once again with the dump ()//becomes the "PHP = = Array (0=>array (...))"   Ask what method can do, I think for a long while really can't think out, manual also check//seemingly no such function, to you can help, thank you


------Solution--------------------
By deleting and merging, you probably don't have a function that directly implements this function.

PHP Code
$key = ...; $arr = Array_merge (Array ($key = Array_shift ($arr)), $arr);
------Solution--------------------
For a bit.
------Solution--------------------
Re-construct an array.
------Solution--------------------
PHP Code
$ar 1 = Array (1 = = Array (' 111 '), 6 = = Array (' 666 '), 2 = = Array (' 222 ')), $ar 2 = Array (' PHP ', ' AJAX ', ' MySQL '); $ar 2 = Array_combine ($ar 2, Array_values ($ar 1)), Echo '
';p Rint_r ($ar 2);
------Solution--------------------
PHP Code
[[email protected] csdn]$ php exchange.php Array ([PHP]/= Array ([0] = index 1) [ AJAX] = = Array ([0] = = Index 6) [MySQL] = Array ([0] = = Inde x 2)) [[email protected] csdn]$ cat exchange.php
       Array ("Index 1"), 6 = a Rray ("index 6"), 2 = AR                        Ray ("Index 2")), $arr 2 = Array ( ' PHP ' = = Array (), ' AJAX ' = = Array (), ' MySQL ' =&gt ; Array ()); $arr 2 = Array_combine (Array_keys ($arr 2), Array_values ($arr 1));p Rint_r ($arr 2);? >
  • 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.