I’m a bit perplexed with this code. $this->product is an Object with 12 vars. The var_dump indicates that $key is a string.
foreach ($this->product as $key => $val) {
if (($key !== "id") || ($key !== "weight")) {
var_dump($key);
} else {
print_r("Success" . $key);
}
}
Despite “id” and “weight” being present as var names and represented as strings within $key they are not caught with this conditional. Does anyone have any ideas?
I think you meant to do:
(($key !== "id") || ($key !== "weight"))is always true,$keycan’t be “id” and “weight” at the same time.