PHP: How to find occurrence of a * wildcard character in a string

前端 未结 1 882
遇见更好的自我
遇见更好的自我 2021-01-26 01:00

Maybe I\'m asking a bit too banal question, but I really cannot figure out how to check for an occurrence of a wildcard (*) character in a string using PHP.

An example s

1条回答
  •  失恋的感觉
    2021-01-26 01:12

    if (strpos($mystring, '*') === false) {
        echo "Wildcard was not found in the string '$mystring'";
    } else {
        echo "Wildcard was found in the string '$mystring'";
    }
    

    Based on the example at http://php.net/manual/en/function.strpos.php

    0 讨论(0)
提交回复
热议问题