PHP Code:
function isLoggedIn(){ echo '1'; }
if(isLoggedIn()){ echo '1'; }
else{ echo '0'; }
the function will print "1". after the function is finished, the if...else statement will print "0".
[...aside...]
I assume that this is only an example, and that you know that the above code, "as-is," is completely pointless: you will always get "10".
A more practical implementation would be:
PHP Code:
function isLoggedIn(){
if(/* user is logged in */){ return TRUE; }
else{ return FALSE; }
}
if(isLoggedIn() === TRUE){ print '1'; }
else{ print '0'; }
Bookmarks