PHP if Variable is populated or has a value

<?php $calories = $variant->getCalories();?> <?php if (empty($calories)) { ?> <?php } if (isset($calories)) { ?> | <?php echo($calories);?> <?php } ?>
I have a restaurant menu I'm building and I need to group price with calories.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.