newbtophp Posted September 2, 2010 Share Posted September 2, 2010 How can I check if a function has returned false.. I know theirs the following way: if (!checkdate($month, $day, $year)) { //the function has returned false } But is their another way (beside using the ! operator) perhaps === FALSE (not sure if that'd work so asking)? Quote Link to comment https://forums.phpfreaks.com/topic/212323-check-if-function-returns-false/ Share on other sites More sharing options...
premiso Posted September 2, 2010 Share Posted September 2, 2010 if (function($params) === false) // check if the return value is EXACTLY false, so the type is required to be boolean. if (function($params) == false) // Just requires the data to be null, 0, '' or false. if (!function($params)) // Just requires the data to be null, 0, '' or false. Quote Link to comment https://forums.phpfreaks.com/topic/212323-check-if-function-returns-false/#findComment-1106277 Share on other sites More sharing options...
newbtophp Posted September 2, 2010 Author Share Posted September 2, 2010 cheers premiso! Quote Link to comment https://forums.phpfreaks.com/topic/212323-check-if-function-returns-false/#findComment-1106278 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.