When looping over an array using foreach
, a copy is usually made. Changing something in the copy of course has no effect on the original. Try this:
foreach($json_output["Products"] as & $bla)
unset($bla['ArticleNumber'], $bla['LastShopUpdate']);
The &
causes $bla
to be a reference instead of a copy. Therefore it should resolve your problem.