I'm new to PHP but I'm running into a problem with the following: I have a
$ Var < / Code> in strtotime ()
function. Like this: $ var = $ _POST ['yyyy'] $ _POST ['MM'] $ _POST ['DD']; // function function blah () {strotomium ($ var); $ Time = $ date -time (); $ NumberofDays = roof ($ time / 86400); Return $ numberofDays; }
How do I insert $ var
into the strtotime
function?
$ var
is outside the scope of your function's function to access it You have to pass it as a parameter for. Remembering the value and assignment of the value of $ date
, which I'm assuming is the first line of your function.
$ var = $ _POST ['Yay'] $ _POST ['MM'] $ _POST ['DD']; Function Blah ($ var) {$ date = strtotime ($ var); $ Time = $ date -time (); $ NumberofDays = roof ($ time / 86400); Return $ numberofDays; } Echo Blah ($ var);