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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Socket.connect doesn't throw exception in Android -

iphone - How do I keep MDScrollView from truncating my row headers and making my cells look bad? -