This echo inside an if/else block is not working at the end of a script?

I'm not sure if this is the full extent of your problem, but your conditions aren't correct.

I'm not sure if this is the full extent of your problem, but your conditions aren't correct. If (!($user->error() === false)) { echo "Authenticated! "; } else { echo $user->error(); } The echo $user->error(); inside the else statement will only ever execute if $user->error() === false.In this case you will be executing echo false;, which will give you no echoed output.

To resolve this problem, use this instead (assuming $user->error(); returns false if no errors exist): if ($user->error() === false) { echo "Authenticated! "; } else { echo $user->error(); }.

1 Wow. Go figure, it was that simple. I didn't even think about checking the conditions - I was looking for something more complex, it's always something simple.Thanks.

(I can't accept as the right answer yet, 2 more minutes :P) – izuriel Dec 26 '11 at 22:13 The funniest thing about it is when I did a var_dump to test the condition and make sure it was evaluating properly I did var_dump($user->error === false) without the! /sigh – izuriel Dec 26 '11 at 22:41 1 A perfect example of why it's so important to write simple code if at all possible.It's very easy to gloss over a! Symbol at the beginning of an if statement, while!

== would have been immediately obvious. – Abhi Beckert Dec 26 '11 at 23:16 @AbhiBeckert Noted. I never thought of that.

Thank you. – izuriel Dec 26 '11 at 4:21.

Adlawson is right. You can look in php. Ini and see if display_errors is set to On.

If not, set it to ON, then execute your script to see if you get an error. Sometimes, if $class->method() returns an error, you might not see it because of display_errors=Off.

No PHP Errors are being generated and I'm using error_reporting(E_ALL) to set error reporting for the duration of the script which is, at present, the only place I cared to test for it. – izuriel Dec 26 '11 at 22:15.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions