如何在php中列出多维数组?

I have the following array:

array(3) {
  ["status"]=>
  int(1)
  ["statusmsg"]=>
  string(2) "Ok"
  ["acct"]=>


  array(43) {
    [0]=>


 array(23) {
  ["startdate"]=>
  string(15) "10 Nov 01 02:46"
  ["plan"]=>
  string(10) "high_Basic"
  ["suspended"]=>
  int(0)
  ["theme"]=>
  string(2) "x3"
  ["shell"]=>
  string(29) "/usr/local/cpanel/bin/noshell"
  ["maxpop"]=>
  string(9) "unlimited"
  ["maxlst"]=>
  string(9) "unlimited"
  ["maxaddons"]=>
  string(9) "*unknown*"
  ["suspendtime"]=>
  NULL
  ["ip"]=>
  string(14) "174.142.90.148"
  ["maxsub"]=>
  string(9) "unlimited"
  ["domain"]=>
  string(13) "dominio.com"
  ["maxsql"]=>
  string(9) "unlimited"
  ["partition"]=>
  string(4) "home"
  ["maxftp"]=>
  string(9) "unlimited"
  ["user"]=>
  string(6) "user"
  ["suspendreason"]=>
  string(13) "not suspended"
  ["unix_startdate"]=>
  string(10) "1288586771"
  ["diskused"]=>
  string(2) "0M"
  ["maxparked"]=>
  string(1) "2"
  ["email"]=>
  string(22) "email"
  ["disklimit"]=>
  string(5) "1000M"
  ["owner"]=>
  string(4) "high"
}



  }
}

How do I go on the inside of it?

Example: while(array) { echo "$domain<br>"; }

Thank you all now ...

Resolved, thanks all!!

code solution:

$JsonResponse = ConnGateWay();
$JsonResponseOk = json_decode($JsonResponse,true);


$arrayaacct = $JsonResponseOk['acct'];

foreach($arrayaacct as $item) {


echo $item['domain'];
echo "<br>";
  }

Use the print_r function.

Did you try foreach

http://php.net/manual/en/control-structures.foreach.php

http://php.net/manual/en/language.types.array.php

<?php
$arr = array("foo" => "bar", 12 => true);

echo $arr["foo"]; // bar
echo $arr[12];    // 1
?>

I would do it like this:

function work ($array)
{
    foreach ($array as $key => $element)
    {
        if (is_array ($element)
        {
            work ($element);
        }
        else
        {
             // do stuff with the key and element
        }
    }
}

Your arrays have keys. You can access a single cell, or go through them all. Example:

array myArray(
    'startdate'=>'10 Nov 01 02:46',
    'plan'=>'high_Basic',
    'suspended'=>0
);

echo myArray['plan'];  // Would print:  high_Basic
foreach (myArray AS $key=>$value) {
    echo $key;
    echo "=";
    echo $value;
    echo "<br/>";
}
/*
Would print:
startdate=10 Nov 01 02:46
plan=high_Basic
suspended=0
*/

Is there something specific you are trying to achieve?

Lavi

I think array_walk_recursive() is what you need