如何循环到这个数组

i have this array as output.

array(2) { ["Datum"]=> string(10) "2017-05-29" ["ID"]=> array(2) { [2]=> string(19) "75528705-1431953348" [3]=> string(21) "1081357825-1445504448" } }

how can i loop through this array in php ?

this is the code to read the array

<?php
var_dump($_POST);
$val = $_POST;
?>

I have already try this

<?php
foreach($_POST->ID as $val) {
print "waarde = " . $val . " <BR>";
}
?>

This is a declaration of your provided $_POST array:

$_POST=array(
    "Datum" => "2017-05-29",
    "ID" => array(
        2 => "75528705-1431953348",
        3 => "1081357825-1445504448"
    )
);

You can directly access any of its elements by referencing its keys:

echo $_POST["Datum"];  // prints 2017-05-29
print_r($_POST["ID"]); // prints Array([2] => 75528705-1431953348 [3] => 1081357825-1445504448 )
echo $_POST["ID"][2];  // prints 75528705-1431953348
echo $_POST["ID"][3];  // prints 1081357825-1445504448

You are not dealing with an object, so the -> will not work.

Using a foreach loop on the $_POST["ID"] subarray will let you access all of the elements in the subarray.

Code:

foreach($_POST["ID"] as $val){
    echo "waarde = $val<br>";
}

Output:

waarde = 75528705-1431953348
waarde = 1081357825-1445504448
<?php
   foreach($_POST['ID'] as $index => $str) {
       echo "waarde = " . $str . "<br/>";
   }
?>