checkdate not working?

Hi All:

What am I doing wrong here. Checkdate seems to return true and false at the same time. I know this is not possible....I have tried several ways now to assign true/false and make an "if"-decission based on the outcome.

I have been looking at this for nearly an hour now. I can't see what I am doing wrong. I am sure its something silly.....

Thanks,

T :-)
if (checkdate(10,23,2011) == false);
		{
		echo ("FALSE ");
		}
	
	
	if (checkdate(10,23,2011) == true);
		{
		echo ("TRUE ");
		}	
	
	var_dump(checkdate(10,23,2011));

        // outputs: FALSE TRUE bool(true)

Open in new window

krackltAsked:
Who is Participating?
 
Dave BaldwinFixer of ProblemsCommented:
You have two extra ';' in your code above.  The ';' terminates a statement so I don't think the rest of your 'if' statement is considered part of it.  I would format it as below.
if (checkdate(10,23,2011) == false) {
                echo ("FALSE ");
                }
if (checkdate(10,23,2011) == true) {
                echo ("TRUE ");
                }       
        
var_dump(checkdate(10,23,2011));

Open in new window

0
 
Aaron TomoskySD-WAN SimplifiedCommented:
Do ===
http://php.net/manual/en/language.operators.comparison.php
With only two = it doesn't need and actual true or false.
0
 
krackltAuthor Commented:
Thanks aaron for your comment.

=== returns the same result.

=== is only making clear that the type returned is correct as well. Otherwise a 1 may sometimes be interpreted as true... or so I seem to remember.

Anyways, tried === and also tried assigning:
 $result = checkdate(10,23,2011)

and then testing the $result
if ($result == true)...

Same difference.

Any other ideas?

T
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
krackltAuthor Commented:
NOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO!!!!!

I knew it was something completely silly!!!! HAHAHAH. I should go to bed or something.

Thank you Dave!!
0
 
krackltAuthor Commented:
Such a silly mistake. Thanks again for pointing it out.
0
 
Dave BaldwinFixer of ProblemsCommented:
You're welcome, happens to all of us.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.