php check if string contains exist or not

Today, We want to share with you php check if string contains exist or not.In this post we will show you How to check word exist in string or not in PHP?, hear for How to check if string contains substring PHP we will give you demo and example for implement.In this post, we will learn about Find the position of the first occurrence of a substring in a string with an example.

php check if string contains exist or not

There are the Following The simple About php check if string contains exist or not Full Information With Example and source code.

Read Also:  Uppercase Filter using Angular Example

As I will cover this Post with live Working example to develop test if string contains character php, so the check if string contains comma php for this example is following below.

Example 1: check string or not in php

index.php

<?php
//How to check word exist in string or not in PHP?

$str_custom_data = "Hi, I am from USA mywebsite.com";
if (strpos($str_custom_data, "USA") !== false) {
    print_r("Yes, exists");
}

$my_new_url = "www.exampleInfo007.com";
if (preg_match("/example/", $my_new_url))
{
	echo "<br/>the url $my_new_url contains example";
}
else
{
	echo "<br/>the url $my_new_url does not contain example";
}
?>

Web Programming Tutorials Example with Demo

Read :

Read Also:  ng-if Condition using Angular Example

Summary

You can also read about AngularJS, ASP.NET, VueJs, PHP.

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