Checking if a String Contains a Substring in PHP


Use strpos() to find the position of the first occurrence of a substring in a string.

Source Code

if (strpos("Hello, World!", "World") !== false) {
    echo "Found!";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments