I'm using references to alter an array:
foreach($uNewAppointments as &$newAppointment)
{
foreach($appointments as &$appointment)
{
if($appointment == $newAppointment){
$appointment['index'] = $counter;
}
}
$newAppointment['index'] = $counter;
$newAppointments[$counter] = $newAppointment;
$counter++;
}
If I print the array contents, then I receive the expected result. When I iterate over it, all elements seem to be the same (the first).
When I remove the reference operator & in the inner array, all goes normal, except index isn't set.