The following lines of code all produce 21 instead of 3, why? I understand whats it's doing, but how can you do addition problems?
-------------------------
$mo = intval(date("j"));
$mo = ++$mo;
returns 21
-------------------------
$mo = date("j") + 1;
returns 21
-------------------------
$mo = intval(date("j")) + 1;
returns 21
Why won't PHP do a simple addition problem? (2+1=21)?
Moderators: egami, macek, gesf
- gorshing
- New php-forum User
- Posts: 12
- Joined: Thu Dec 05, 2002 5:56 pm
- Location: Oklahoma, US
- Contact:
Were you confused on the date function? He could had thought that it would return the month and not the day of the month.
http://www.php.net/manual/en/function.date.php
passing 'j' gives you the day of the month.
http://www.php.net/manual/en/function.date.php
passing 'j' gives you the day of the month.
gorshing
newb everything
newb everything
-
- New php-forum User
- Posts: 28
- Joined: Fri Jan 03, 2003 4:00 pm
oops. Thank you. I thought j was the month.
I can't believe something so simple cost me so much time.
