2013-03-19 3 views
4
$list=array('Andaman and Nicobar'=>array('North and Middle Andaman', 'South Andaman', 'Nicobar'), 'Andhra Pradesh' => array('Adilabad', 'Anantapur',)); 

sous forme decomment imprimer tableau multidimensionnel?

[['North and Middle Andaman', 'South Andaman', 'Nicobar'],['Adilabad', 'Anantapur']] 
+0

Donc vous demandez comment obtenir PHP pour afficher une représentation JSON de ce tableau imbriqué? Pourquoi le tag JavaScript? – nnnnnn

Répondre

6
$tmp = json_encode($list); 
echo $tmp; 
0

Vous pouvez imprimer tableau multidimensionnel en php un exemple simple ici ...

<?php 
    $company = array(
     array('company','HCL', 'Microsoft','apple'), 
     array('city ','Delhi','California','Newyork'), 
     array('Type','IT','Software','Iphone') 
    ); 
    ?> 
    <table border="1"> 

    <?php 
    foreach($company as $data) 
    { 
     echo '<tr>'; 
     foreach($data as $item) 
     { 
      echo "<td>$item</td>"; 


     } 
     echo '</tr>'; 
    } 
?> 

Ne pas dire merci pour moi ... :)