Is this possible? I see some native php functions can do that. For example: strpos() can return 0 which can apparently be true.
Is this possible? I see some native php functions can do that. For example:
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Edit
When the manual says some function can return both integer 0 and boolean false, it means it can return either integer
0or booleanfalse(not both) in any given call. PHP is not strictly typed, functions can return different types in different situations. For instance, the following function returns either0orfalse, depending on whether the passed parameter is non negative or not:Original
PHP has no multiple return. You have two options:
Return composite values instead
A third possibility is a custom resource, but that must be implemented internally (in an extension).
Use output parameters
Of course, you can return only
0ortrueand use only one parameter.