How to search text in string using php ?

29-10-2017 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 redirect one page to another page in php
20-03-2017 redirect php
How to make an http request in node js
14-03-2017 http module node js
Get previous date from given date in javascript
06-03-2017 date javascript previous date
Filter for insert HTML in Angular Js
06-03-2017 filter show html angular js html
Send Mail in Node Js
21-02-2017 node js mail npm module