strpos Function in PHP

strpos Function in PHP. Using this program we can search the string in group of text. The strpos() method determines the position of a string’s first occurrence within another string. The strpos() function returns the position of a string, while the stripos() function does the same thing but in a case-insensitive manner. Both return the first occurrence of a string within another string’s location.

<?php
echo strpos("welcome to inlarn", "inlarn");
?>

 

Output:

11

strpos() Function in Php

The strpos() method locates the first occurrence of a string within another string. This method assists us in locating the first occurrence of a string within another string. This function returns an integer representing the place of the string’s first occurrence. This function is case-sensitive, which means it differentiates between upper-case and lower-case characters.

String in Php

A string is a grouping of characters. PHP supports a number of data types, including strings. String variables are allowed to include alphanumeric characters. A string is any sequence of characters that a script interprets literally. The length(string) function is the simplest basic example of a string function. The length of a string literal is returned by this method. Other languages may have string functions with similar or identical syntax, arguments, or results.