vendredi 16 juillet 2021

PHP - what is the point of using isSet() and checking for truthy value?

I saw this in my codebase today:

if (isset($purchase_data['buyer_tracking_address_id']) && $purchase_data['buyer_tracking_address_id']) {
    // do something
}

Why would checking for both conditions be necessary? Isn't using just the first clause enough?

Aucun commentaire:

Enregistrer un commentaire