How to do an if statement on a function in PHP?
Posted
by Bruce
on Stack Overflow
See other posts from Stack Overflow
or by Bruce
Published on 2010-02-14T01:52:11Z
Indexed on
2010/05/09
5:28 UTC
Read the original article
Hit count: 235
I just realized that you can't just use an if statement on a function, for example this doesn't work:
function sayHello()
{
echo "Hello World";
}
if(sayHello())
echo "Function Worked";
else
echo "Function Failed";
I also saw that a function can't be put as the value of a variable. So how can I do an if statement to check if a function has executed properly and display it to the browser?
© Stack Overflow or respective owner