ManicMax Posted May 4, 2007 Share Posted May 4, 2007 Currently I cant get a function to work within an if statement what syntax does it need to work. At the moment I have to put the function into a variable then compare it in the if statement. Any help appriciated Link to comment https://forums.phpfreaks.com/topic/50067-using-functions-in-if-statements/ Share on other sites More sharing options...
pocobueno1388 Posted May 4, 2007 Share Posted May 4, 2007 Code would be nice =] Link to comment https://forums.phpfreaks.com/topic/50067-using-functions-in-if-statements/#findComment-245735 Share on other sites More sharing options...
Barand Posted May 4, 2007 Share Posted May 4, 2007 Example <?php function validDay ($d) { /** * assumes any value between 1-31 is valid */ return ($d >=1) && ($d <= 31); } $day = 12; if (validDay($day)) { echo "OK"; } else { echo "Invalid"; } ?> Link to comment https://forums.phpfreaks.com/topic/50067-using-functions-in-if-statements/#findComment-245739 Share on other sites More sharing options...
neel_basu Posted May 5, 2007 Share Posted May 5, 2007 You should post some codes First. Link to comment https://forums.phpfreaks.com/topic/50067-using-functions-in-if-statements/#findComment-245983 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.