Nik Top Posted August 4, 2011 Share Posted August 4, 2011 hi i am having trouble putting a variable in strtotime() $num = "5"; $future=date("Y-m-d", strtotime('+$num day')); please help is there a way to put in a variable Quote Link to comment https://forums.phpfreaks.com/topic/243863-variable-in-strtotime/ Share on other sites More sharing options...
Pikachu2000 Posted August 4, 2011 Share Posted August 4, 2011 Variables aren't interpolated withing single quoted strings. Use double quotes instead. $future=date("Y-m-d", strtotime("+$num day")); Quote Link to comment https://forums.phpfreaks.com/topic/243863-variable-in-strtotime/#findComment-1252190 Share on other sites More sharing options...
Nik Top Posted August 4, 2011 Author Share Posted August 4, 2011 Thank you !!!! so much :D Quote Link to comment https://forums.phpfreaks.com/topic/243863-variable-in-strtotime/#findComment-1252198 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.