Accessing an array that is inside another

2

I have the following array

array(2) {
  [0]=>
  array(1) {
    ["data"]=>
    string(19) "2015-11-20 00:33:53"
  }
  [1]=>
  array(1) {
    ["data"]=>
    string(19) "2015-11-20 08:24:50"
  }
}

How do I access the two ['data'] 's?

    
asked by anonymous 21.11.2015 / 01:11

1 answer

3

As follows:

echo $seuArray[0]['data'];
echo $seuArray[1]['data'];

Or by a for loop:

for ($i = 0; $i < count($seuArray); $i++) {
    echo $seuArray[$i]['data'];
}

Or with foreach loop:

foreach($seuArray as $item) {
    echo $item['data'];
}
    
21.11.2015 / 01:18