Using foreach()
you could do something like…
foreach ( $phpObjekt->products as $product ) {
//Speicherung der Daten in Variabeln
$productId = $product->id;
// ...
foreach ( $product->categories as $category ) {
$categoryID = $category->id;
// ..
}
}
solved PHP Print all objects of an array in an array