lalnfl Posted November 12, 2010 Share Posted November 12, 2010 I have this php code: length is 15 , that is what it is coming out of the database $length = $get['length']; $time = date('Y-m-d', strtotime('+$length days')); But when I echo time it comes out with this result 1969-12-31 What am I doing wrong? Link to comment https://forums.phpfreaks.com/topic/218515-strtotime-and-php-variable-help/ Share on other sites More sharing options...
kenrbnsn Posted November 12, 2010 Share Posted November 12, 2010 String encloseds in single quotes are not evaluated. Replace the single quotes with double quotes: <?php $time = date('Y-m-d', strtotime("+$length days")); ?> Ken Link to comment https://forums.phpfreaks.com/topic/218515-strtotime-and-php-variable-help/#findComment-1133582 Share on other sites More sharing options...
lalnfl Posted November 12, 2010 Author Share Posted November 12, 2010 String encloseds in single quotes are not evaluated. Replace the single quotes with double quotes: <?php $time = date('Y-m-d', strtotime("+$length days")); ?> Ken Thank you! Link to comment https://forums.phpfreaks.com/topic/218515-strtotime-and-php-variable-help/#findComment-1133586 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.