Better way to perform ternary operator in php

Viewed 26

wherever I have to write a code that checks the nullability and then preform upon that I write it like this:

$variant->variant_sku != null ? $skus[] = $variant->variant_sku : '';

Is there a better way to do it?

0 Answers
Related