Forum Moderators: coopster

Message Too Old, No Replies

if else with functions

         

dkin

1:35 am on Aug 10, 2004 (gmt 0)

10+ Year Member



I am trying to verify that a function is correctly being called.

I have this page as a test

<?php

include("functions.php");

if (connect()) {

print "it worked";
}
else {

print "try again";

}
?>

the function is created properly but the output is try again.

very easy no doubt but I have never tried this.

Thanks before hand.

Cheers

Birdman

2:02 am on Aug 10, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Your function probably needs a "return" value.

function foo(){
if (do_something($bar)){
return true;
} else {
return false;
}

}