php - Outputting values from a multi-dimensional array -
this question has answer here:
$this->load->library('opencloud'); $opencloud = new opencloud; $containers = $this->opencloud->list_containers(); print_r($containers);
the above code outputs following array:
array ( [0] => array ( [name] => .cdn_access_logs [count] => 2 [bytes] => 606 ) [1] => array ( [name] => michael grigsby [count] => 9 [bytes] => 891976 ) [2] => array ( [name] => random photos [count] => 0 [bytes] => 0 ) [3] => array ( [name] => hello [count] => 10 [bytes] => 1129257 ) [4] => array ( [name] => hello_world [count] => 1 [bytes] => 659737 ) [5] => array ( [name] => hi [count] => 0 [bytes] => 0 ) )
when echo out $containers[1]['name']
get: michael grigsby
. question how script output of name
values rather one?
you can echo name of each array in classic mode in php foreach loop this:
foreach($containers $container){ echo($container['name']); }
Comments
Post a Comment