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 search text in string using php ?29-10-2017 php search string search |
How to submit form using javascript or jquery.16-04-2017 javascript jquery submit form |
How to get current date and time (yyyy-mm-dd H:i:s) using javascript09-03-2017 javascript date time |
Using slice remove last two characters from given string07-03-2017 slice remove |
Sample Validations in javascript22-02-2017 validations javascript |