php - Unsetting properties in an object -


i trying unset in object.

foreach($curdel $key => $value) { if ($value == $deletedinfo[0]) {     print_r($key);     print_r($curdel);     unset($curdel[$key]); } } 

as expected, $key returns correct value (0) , $curdel returns entire array. trying unset $curdel[$key] breaks everything. trying print_r($curdel[$key]) breaks everything, missing?

my object looks this:

stdclass object ( [0] => ifso14-03-21-14.csv [2] => eb_bunny.jpg [3] => eb_white_bear.jpg ) 

instead of:

unset($curdel[$key]); 

try:

unset($curdel->$key); 

arrays accessed/modified via [] objects , class properties accessed via ->


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -