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:

Check null values in JavaScript?

04-02-2019 JavaScript null check null value

File Upload Using Angular Js and Node Js

28-05-2018 AngularJs Node js file upload multer module

How to use request module in node js

16-03-2017 request module node js

Sanitization in java sript

14-03-2017 sanitization java script

Email validation regular expression in javascript

22-02-2017 email validation regex