![]() |
return boolean in function scope
What does it mean for a functions scope to have a boolean false, when returning the boolean.
Example: PHP Code:
|
It makes no sense to write a function exactly like the one you posted, because the function will always return
TRUE. However it can be useful to have multiple return points based on different conditions.PHP Code:
|
I return booleans if the function is suppose to perform an action but isn't required to return data. True and false lets me know if the function was successful or not. It also allows me to not put error handling within the function so that other people can use it easily or I can do whatever I want with the error outside of the function.
|
| All times are GMT. The time now is 11:48 PM. |
Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0