Page 1 of 1

strpos failing to output FALSE!

Posted: Wed Apr 26, 2017 6:06 pm
by UniqueIdeaMan
It is said on the following link:
**Using the strpos() function**
**The strpos() function is used to search for a string or character within a string.**

**If a match is found in the string, this function will return the position of the first match. If no match is found, it will return FALSE.**

https://www.tutorialspoint.com/php/php_strings.htm

Isn't the following supposed to output to screen "FALSE" ? I do not see this happening.

Code: Select all

   <?php
      echo strpos("Hello world!","s");
    ?>

Re: strpos failing to output FALSE!

Posted: Thu Apr 27, 2017 2:38 am
by requinix
Everything that gets outputted gets converted to a string. False is converted to an empty string. Try var_dump instead.