I am trying to download multi-line orders from eBay in a loop. If it is not a multi line order, which is most orders, I get:
PHP Notice: Trying to get property of non-object in....line 605
Here is my code:
for ( $counter = 0; $counter <= $n_ord; $counter += 1) {
$multi=0;
if (!is_object($retxml->OrderArray[0]->Order[$counter]->TransactionArray->Transaction[$multi]->OrderLineItemID)) {
$OrderLinetest = '';
} else {
$OrderLinetest = $retxml->OrderArray[0]->Order[$counter]->TransactionArray->Transaction[$multi]->OrderLineItemID;
}
while ($OrderLinetest<>''){
//:
//Process the order
//:
$multi++; //line 604:
if (!is_object($retxml->OrderArray[0]->Order[$counter]->TransactionArray->Transaction[$multi]->OrderLineItemID)) {
$OrderLinetest = ''; //line 605:
} else {
$OrderLinetest = $retxml->OrderArray[0]->Order[$counter]->TransactionArray->Transaction[$multi]->OrderLineItemID;
}
} // end multi item while loop
} // end for loop of items
What is the best way to test if it is an object?
Should I use isset
?