I am trying to unset something in an object.
foreach($curdel as $key => $value) {
if ($value == $deletedinfo[0]) {
print_r($key);
print_r($curdel);
unset($curdel[$key]);
}
}
As expected, $key
returns the correct value (0) and $curdel
returns the entire array. But trying to unset $curdel[$key]
breaks everything. even trying to print_r($curdel[$key])
breaks everything, what am I missing?
My object looks like this:
stdClass Object ( [0] => IFSO14-03-21-14.csv [2] => EB_Bunny.jpg [3] => EB_White_Bear.jpg )