php - Why isn't this simple IF statement not working? -
i can't script work nothing. tried many different ways make work it's not working.
<?php if (!empty ($image->alttext )) : ?> <div class="thumbtitle"><?php echo $image->alttext ?></div> <?php endif; ?>
any appreciated!
it shows true there alttext when there isn't sometimes.
your question vague try following
<?php if (strlen(trim($image->alttext)) > 0) : ?> <div class="thumbtitle"><?php echo $image->alttext ?></div> <?php endif; ?>
as said string not empty whitespaces. use var_dump() or strlen() find out. trim remove whitespaces.
Comments
Post a Comment