2👍
✅
You only need to make sure that :rating=""
won’t occur. <?= null ?>
would output nothing.
So how about setting it to an empty string if it’s null
<review :rating="<?= $reviewAverage !== null ? $reviewAverage : '' ?>"></review>
if it’s null, this would be the generated html
<review :rating="''"></review>
Source:stackexchange.com