I am trying to get values from array inside of another array. I have seen lots of answers here about this but i cannot manage to do so. I have an array like this:
Array
(
[0] => Array
(
[listingid] => 1234
[availability] => Array
(
[0] => Array
(
[von] => 2015-11-07
[bis] => 2016-03-19
)
[1] => Array
(
[von] => 2016-03-19
[bis] => 2016-03-28
)
[2] => Array
(
[von] => 2016-03-28
[bis] => 2016-07-30
)
)
)
[1] => Array
(
[listingid] => 5678
[availability] => Array
(
[0] => Array
(
[von] => 2015-11-07
[bis] => 2016-03-19
)
[1] => Array
(
[von] => 2016-03-19
[bis] => 2016-03-28
)
[2] => Array
(
[von] => 2016-03-28
[bis] => 2016-07-30
)
)
)
)
and i do this to get values:
foreach($first as $key => $value){
echo "Value: " . $value[$key]['availability']['von'] . "<br>";
}
which normally should work based on the answers i saw but it gives me empty value.
I have also tried this:
foreach($first as $key => $value){
$listid = $value['listingid'];
echo $listid;
}
and this gives me the value of the listingid. How can i get values for von and bis?
Any suggestions?
listingid:$value['listingid'];and how you accessavailability:$value[$key]['availability']['von']. And also look in which dimension both of those keys are..$value['listingid']and$value[$key]['availability']['von'], so you know the first one works. Now also compare where those two keys are located:listingidandavailability