2010-09-03 4 views
0

J'ai la prochaine série (columsData $):Php concaténation des tableaux

Array 
(
    [avatar] => Array 
     (
      [title] => Avatar 
      [sort] => 
      [no_html_escape] => 1 
     ) 
    [title] => Array 
     (
      [title] => Title 
      [sort] => 
     ) 
) 

Et comment puis-je faire de ce tableau comme ceci:

Array 
(
    [id] => Array 
     (
      [title] => Id 
      [no_html_escape] => 1 
     ) 
    [avatar] => Array 
     (
      [title] => Avatar 
      [no_html_escape] => 1 
     ) 
    [title] => Array 
     (
      [title] => Title 
      [no_html_escape] => 1 
     ) 
) 

Merci.

+1

Pouvez-vous donner un meilleur exemple? D'où vient le tableau 'id'? Que représente le tableau? –

+2

Vous pouvez utiliser l'opérateur '+' pour concaténer des tableaux? –

+1

* (lié) * http://stackoverflow.com/questions/2140090/operator-for-array-in-php/2140094#2140094 – Gordon

Répondre

0
$columsData['id']['title'] = 'id'; 
$columsData['id']['no_html_escape'] = 1; 
+0

Il est préférable d'initialiser l'élément '$ columnsData ['id']' en tant que tableau premier... – ircmaxell