How to make strpos case insensitive

前端 未结 4 761
离开以前
离开以前 2020-11-28 10:47

How can I change the strpos to make it non case sensitive. The reason is if the product->name is MadBike and the search term is bike it wil

4条回答
  •  猫巷女王i
    2020-11-28 11:34

    'i' in stripos() means case insensitive

    if(stripos($product->name, $searchterm) !== false){ //'i' case insensitive
            echo "Match = ".$product->link."
    ; }

提交回复
热议问题