I need to set variable, let’s call it $times
to specific amount of 8AM. I tried using mktime(08,00)
but it returns
Parse error: Invalid numeric literal
Since I’m new to php, I still don’t know which function is best used for thing such as this, weather it is time() date() or so.
My question is: how do I set $times
to be 8AM of current day?
I’ve checked a lot of similar questions, but none of them have an answer. Not even the one that this is marked duplicate of.
Advertisement
Answer
Just remove the leading zeros.
mktime(8, 0);
It’s because PHP is interpreting 08
as an octal number, and 8 is out of range in octal (0-7).