How to search text in string using php ?

php
search
string search

Suppose I have string below,

$text = "Hello World!";

By using below code to get string position. By using string position we can check/search in a given string.

if (strpos($text, 'World') !== false) {
    echo 'true';
}

Basically the expected ouput is "true".

Note that the use of !== false is deliberate. The strpos() function finds the position of the first occurrence of a string inside another string.

You might also like:

How to upload file by using request module

18-03-2017 request module node js

How to convert html to pdf in Node js

12-03-2017 pdf convert html node js

How to find Angular Errors

06-03-2017 errors angularjs exceptionHandler

Filter for insert HTML in Angular Js

06-03-2017 filter show html angular js html

How to change background color and color to the text using javascript

27-02-2017 css javascript colors