strpos failing to output FALSE!

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Forum Contributor
Posts: 197
Joined: Wed Jan 18, 2017 3:43 pm

strpos failing to output FALSE!

Post 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.**

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

Code: Select all

      echo strpos("Hello world!","s");
User avatar
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: strpos failing to output FALSE!

Post by requinix »

Everything that gets outputted gets converted to a string. False is converted to an empty string. Try var_dump instead.
Post Reply