I would prefer the strpos
over preg_match
, because regexes are generally more expensive to execute.
According to the official php docs for preg_match
:
Do not use
preg_match()
if you only
want to check if one string is
contained in another string. Use
strpos()
orstrstr()
instead as they
will be faster.