booleans casted to strings

What happens when a false value is casted to a string?

I.e. what is the result of the following:
< ?php
var_dump((string)false);
?>

The answer is:
string(0) ""

This is good to know and expect when using some string functions that sometimes return a string and sometimes a boolean. Such functions are strstr(), strpos(), etc.

Bookmark and Share

Somewhat related posts

Leave a Reply