Which method can be used to change the first subscript of the array, and dump () is used to print the new subscript. The code is as follows: PHPcodearray (1 & gt; array (0 & gt; array (created & gt; integer1332383287updated & gt; how can I change the first subscript of an array, dump () is used to print the new subscript. The code is as follows:
PHP code
Array (1 => array (0 => array ('created '=> integer 1332383287 'updated' => integer 1332385146 'id' => string '30' (length = 2) 'level' => integer 10' tag _ id' => integer 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 '))) // The requirement is "1 => array (0 => array (......)) "Here 1 is changed to php, ajax, and other text, and then again with dump () print it out // it becomes "php => array (0 => array (......)) "How can I do this? I couldn't think of it for a long time, and I checked the manual. // It seems that there is no such function. thank you for your help.
------ Solution --------------------
Delete and merge the functions. maybe there are no functions that directly implement this function.
PHP code
// $ Key = ......; $ Arr = array_merge (array ($ key => array_shift ($ arr), $ arr );
------ Solution --------------------
For.
------ Solution --------------------
Rebuild an array.
------ Solution --------------------
PHP code
$ Ar1 = array (1 => array ('20160901'), 6 => array ('20160901'), 2 => array ('20160901 ')); $ ar2 = array ('php', 'Ajax ', 'mysql'); $ ar2 = array_combine ($ ar2, array_values ($ ar1); echo''; Print_r ($ ar2 );
------ Solution --------------------
PHP code
[[email protected] csdn]$ php exchange.php Array( [PHP] => Array ( [0] => index 1 ) [AJAX] => Array ( [0] => index 6 ) [MySQL] => Array ( [0] => index 2 ))[[email protected] csdn]$ cat exchange.php
array( "index 1" ), 6 => array( "index 6" ), 2 => array( "index 2" ) );$arr2 = array( 'PHP' => array(), 'AJAX' => array(), 'MySQL' => array() );$arr2 = array_combine(array_keys($arr2), array_values($arr1));print_r($arr2);?>