Here's an example of my array:
array(4) {
[0]=>
array(2) {
["id"]=>
string(4) "id-1"
["articles"]=>
array(2) {
[0]=>
array(1) {
["data"]=>
array(6) {
["art"]=>
string(6) "108108"
["type"]=>
string(0) ""
["pos"]=>
string(3) "125"
["kleur"]=>
string(4) "3750"
["height"]=>
string(3) "179"
["foto"]=>
string(2) "01"
}
}
[1]=>
array(1) {
["data"]=>
array(6) {
["art"]=>
string(0) ""
["type"]=>
string(0) ""
["pos"]=>
string(3) "163"
["kleur"]=>
string(0) ""
["height"]=>
string(0) ""
["foto"]=>
string(0) ""
}
}
}
}
[2]=>
array(2) {
["id"]=>
string(7) "ui-id-2"
["articles"]=>
array(2) {
[0]=>
array(1) {
["data"]=>
array(6) {
["art"]=>
string(0) ""
["type"]=>
string(0) ""
["pos"]=>
string(3) "944"
["kleur"]=>
string(0) ""
["height"]=>
string(0) ""
["foto"]=>
string(0) ""
}
}
[1]=>
array(1) {
["data"]=>
array(6) {
["art"]=>
string(0) ""
["type"]=>
string(0) ""
["pos"]=>
string(3) "586"
["kleur"]=>
string(0) ""
["height"]=>
string(0) ""
["foto"]=>
string(0) ""
}
}
}
}
}
As an example, I want to change the value of art where the id is id-1 and where the pos is 163.
I started, but got stuck somewhere deep...
foreach($data as $key => $value) {
if($value['id'] === "id-1") {
foreach($value as $tweek => $tweev) {
foreach($tweev as $driek => $driev) {
foreach($driev as $vierk => $vierv) {
if($vierv['pos'] === "163") {
// This is the right article! I think...
echo $vierv['pos'] . "<br />"; // shows 163!
foreach($vierv as $vijfk => $vijfv) {
// What to do?!?!
}
}
}
}
}
}
}
Am I on the right track? What's next? Anyone that is able to point me in the right direction?
var_dump() -> var_export()