Searching partial strings PHP

后端 未结 3 1777
我寻月下人不归
我寻月下人不归 2021-02-09 06:25

How can you search a partial string when typing (not to use MySQL) like the LIKE function in MySQL but using PHP when searching a string, e.g.



        
3条回答
  •  悲&欢浪女
    2021-02-09 06:40

    strpos() can do that.

    if(strpos($string, $find) !== false)
    . . .
    

    Note that it may return 0, so do use the type-equals operator.

提交回复
热议问题