The example in this article describes a method for PHP to simply determine whether a string contains another string. Share to everyone for your reference, specific as follows:
When using PHP to determine if a string contains a simple substring, we usually use Strpos () or stristr (), but if the position of the string is at index 0, that means the beginning of the string to match.
Of course, we still have a solution, there is a stupid way, but it is easy to use, both in English and Chinese, punctuation is applicable.
The code is as follows:
function Checkstr ($str, $target)
{
$tmpArr = explode ($str, $target);
Print_r ($TMPARR);
if (count ($TMPARR) >1) return true;
else return false;
$result = Checkstr ("SDFG", "BSDFSLDKFJ");
Var_dump ($result);
For more information on PHP-related content readers can view the site topics: "PHP operation Office Document tips summary (including word,excel,access,ppt)", "PHP date and Time usage summary", "PHP object-oriented Program Design Introductory Course", "PHP string (string) Summary of usage, Getting Started tutorial on Php+mysql database operations, and summary of common PHP database operations techniques
I hope this article will help you with the PHP program design.