Home  >  Article  >  Backend Development  >  How to determine whether a string exists in php

How to determine whether a string exists in php

WBOY
WBOYOriginal
2016-07-25 09:12:213048browse

Example, use === or !== to determine whether a string exists.

Code:

  1. if(stripos($sql, "insert") === 0){
  2. $excuteResult = mysql_query($sql);
  3. if($excuteResult){
  4. $sql = $ sql2."where id = (select max(id) from subway2)";
  5. }
  6. } else if(stripos($sql, "delete") === 0 || stripos($sql, "update") == = 0){
  7. if (strpos($foo, “my”)===0) { echo('I find!');}
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn