-1

In PHP how to I return the value 1, 2 and 3 in the array bellow?

$tmpArray =
   array(
       array("one", array(1, 2, 3)),
       array("two", array(4, 5, 6)),
       array("three", array(7, 8, 9)
   )
);
4

3 回答 3

1
$tmpArray[0][1] = array(1, 2, 3)
$tmpArray[0][1][0] = 1
$tmpArray[0][1][1] = 2
$tmpArray[0][1][2] = 3
于 2013-03-30T09:39:41.977 回答
0

Try like this

foreach($tmpArray as $key => $value)
{
    foreach($value as $val)
       echo $val.'<br>';
}
于 2013-03-30T09:38:00.927 回答
0

try this-

foreach($tmpArray as $key => $value)
{
  if(is_array($value)){
    foreach($value as $val)
      if(is_array($val){
        foreach($val as $v)
          echo $v."<br />";
      }
      else
        echo $val.'<br />';
  }
  else
      echo $value."<br />";
}
于 2013-03-30T09:40:25.777 回答