tec-4 Posted June 17, 2011 Share Posted June 17, 2011 Hello all, Have a conditional statement that I would only like to appear only if one variable is less than another one. For example, I have example code as follows: <?php foreach($numbers as $number) { ?> <div class="number"> <div class="number_highlight"> <?php $show_new_date = round((time() - strtotime($number->BeginningDate)) / (60 * 60 * 24)); $testing_low_date = 14; if ($show_new_date <= $testing_low_date) { echo '<p>hello</p>'; } } ?> I cannot seem to echo the statement correctly with the above calculations and conditional statement. The $show_new_date is a date from a database, from when something was created and $testing_low_date is the number of days I'd like to test to see if the date from the database is below Anyone see where in the above code I may be going wrong, or overlooking? Thanks. Link to comment https://forums.phpfreaks.com/topic/239693-conditional-checking-less-than-value/ Share on other sites More sharing options...
Adam Posted June 18, 2011 Share Posted June 18, 2011 Can you provide some example data? Most likely $show_new_data doesn't contain what you expect. Link to comment https://forums.phpfreaks.com/topic/239693-conditional-checking-less-than-value/#findComment-1231317 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.