I’m doing something wrong and I can’t figure out what to do about it (how to fix it)
code:
var_dump($each->promotion-type);
returns:
PHP Notice: Use of undefined constant type - assumed 'type' in newfile.php on line 19
I can’t change that variable name as that how I get from my vendor, any ideas how I can access that promotion-type variable? (syntax wise)
It’s spitting that notice because the expression is being interpreted as variable
$each->promotionminus constanttype.To access a property with the dash in its name, use curly braces and quotes: