I want to clean a specific index of array, in particular I've 3 index:
0:
Appointments
Unavailables
1:
Appointments
Unavailables
2:
Appointments
Unavailables
Now I want maintain the first appointments as 0 index. So this is my code:
foreach($appointments as $key => value)
{
if($key != 0)
{
unset($appointments[$key]['appointments']);
}
}
but unset delete also the key so the final result that I get is:
0:
Appointments
Unavailables
1:
Unavailables
2:
Unavailables
I want maintain the appointments object, just I need to empty it's content.
How I can achieve this result?
0 comments:
Post a Comment