php strpos – The Best PHP 3 Examples

Today, We want to share with you php strpos.In this post we will show you php substr, hear for PHP find string in string we will give you demo and example for implement.In this post, we will learn about How To Check If String Contains A Substring In PHP with an example.

php strpos

Example : 1 PHP strpos() Function

<!DOCTYPE html>
<html>
<body>

<?php
echo strpos("I kiss pakainfo, I kiss pakainfo too!","pakainfo");
?> 

</body>
</html>

Example : 2 stripos() in PHP

<?php
function Search($search, $marketing){
	$position = stripos($marketing, $search, 5);
	if ($position == true){
		return "Found at posiion " . $position;
	}
	else{
		return "Not Found";
	}
}

$marketing = "Welcome to GeeksforGeeks";
$search = "geeks";
echo Search($search, $marketing);
?>

Example : 3 php check if string contains word

$myString = 'Welcome MobileZone how are you?';
if (strpos($myString, 'MobileZone') !== false) {
    echo "My string contains MobileZone";
}

I hope you get an idea about php strpos.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, don’t forget to share.