PHP Removing by reference

I’m trying to remove stdClass property by reference. Because I don’t know how deeply the property is nested, a reference is made in the loop. But the unset method does not remove variables by reference. How can I resolve it without just setting a null value?

unset values null array multidimensional php

this is my first time on stackoverflow so sorry if I do something wrong. I would also appreciate your advice. I have the next Array: $dataPayment= [ "operationType" => null "terminal" => 12345 "payment" => array:14 [ "terminal" => 12345 "order" => "1234519997" "amount" => 100 "currency" => "EUR" "secure" => 0 "idUser" => 123456789" … Read more