and trying to add an extra row(key : value). so this is my loops:
$newarray = [];
foreach($allJobs as $allJob)
{
for($i = 0; $i < 2 ; $i++){
$allJob->bku = $i;
$newarray[] = $allJob;
}
}
output now:
Array
(
[0] => stdClass Object
(
[id] => CFF9B1A6-37B8-4000-B058-03DC648B5289
[name] => Kreditor rapporter til RE pkt. 5
[bku] => 1
)
[1] => stdClass Object
(
[id] => CFF9B1A6-37B8-4000-B058-03DC648B5289
[name] => Kreditor rapporter til RE pkt. 5
[bku] => 1
)
but as you can se the last key value pair is the same - [bku] => 1;
What I want:
Array
(
[0] => stdClass Object
(
[id] => CFF9B1A6-37B8-4000-B058-03DC648B5289
[name] => Kreditor rapporter til RE pkt. 5
[bku] => 0
)
[1] => stdClass Object
(
[id] => CFF9B1A6-37B8-4000-B058-03DC648B5289
[name] => Kreditor rapporter til RE pkt. 5
[bku] => 1
)
So it increment my extra row bku in the nested loop.