Php 如何打印多维数组?
以Php 如何打印多维数组?,php,javascript,json,Php,Javascript,Json,以 $list=array('Andaman and Nicobar'=>array( 'North and Middle Andaman', 'South Andaman', 'Nicobar' ), 'Andhra Pradesh' => array( 'Adilabad', 'Anantapur',)); 可以通过php打印多维数组 这里有一个简单的例子 $tmp = json_encode($list); echo $tmp; 不要对我说thanx…:) 所以你问的是
$list=array('Andaman and Nicobar'=>array( 'North and Middle Andaman', 'South Andaman', 'Nicobar' ), 'Andhra Pradesh' => array( 'Adilabad', 'Anantapur',));
可以通过php打印多维数组 这里有一个简单的例子
$tmp = json_encode($list);
echo $tmp;
不要对我说thanx…:) 所以你问的是如何让PHP输出嵌套数组的JSON表示?为什么使用JavaScript标记?
$tmp = json_encode($list);
echo $tmp;
<?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>';
}
?>