This seems really clunky:
if (empty($xml['soap:Envelope']['soap:Body']['SendPurchasesResponse']['PurchasesResponse']['Status']['Code'])) {
$status = $xml['soap:Envelope']['soap:Body']['SendPurchasesResponse']['PurchasesResponse']['Status']['Code'];
}
Is there a better way to handle "Undefined index" errors in the event that some of those array keys are missing? As you might guess, this array is coming from an XML based API and I can't trust their response to me.
Do you think using suppressing errors using "@" is a cop out:
$status = @$xml['soap:Envelope']['soap:Body']['SendPurchasesResponse']['PurchasesResponse']['Status']['Code'];