Problem:- How to Access Substring in PHP
You want to know if a string contains a particular substring how we can access that. For example we get a email id and we want to check @ in that email so how can we.
Solution – How to Access Substring in PHP
<?php $email = info@159.89.173.208; if(strpos($email, @) === false){ print 'this is not a vaild email address'; } ?>
How It Works
The return value from strpos() function the first parameter is haystack and 2nd parameter is needle that we want to check in out string(haystack). if no match found then we compare it with false that mean our condition is true and we will get this is not a valid email address output otherwise no output