Are you first timer at lazacode.org? Why not join us and start exchange your knowledge with everyone. Register today!

PHP - if there's a value or no value

0 votes
7 views
added Mar 27 in PHP by LC Marshal Second Warrant Officer (6,010 points)
edited 1 day ago by LC Marshal
<?php if (!empty($bedrooms)): ?>
    <div class="hidden-t-m"><?php print $bedrooms ?> Beds</div> 
<?php endif; ?>

3 examples

0 votes
responded 5 days ago by LC Marshal Second Warrant Officer (6,010 points)
edited 1 day ago by LC Marshal

If value has no character or null

<?php if ($row['authname']==0): ?>
    <span class="show-anon">Anonymous</span>
<?php endif; ?>
0 votes
responded 3 days ago by LC Marshal Second Warrant Officer (6,010 points)
edited 1 day ago by LC Marshal

If value is not null

<?php if (!empty($title)): ?>
    <h1 class="page-header"><?php print $title; ?></h1>
<?php endif; ?>
0 votes
responded 1 day ago by LC Marshal Second Warrant Officer (6,010 points)

If empty

<?php if (empty($row['name'])): ?>
    Anonymous
<?php endif; ?>
lazacode.org - Malaysia based Knowledge Exchange Platform, where you can share your finding or solution with other members of community.
...