Twitch
Twitch

Reputation: 233

strpos() / stripos() bug or expected behavior?

I'm trying to check if <script or <link is in a string.

if (stripos($string, '<script') !== FALSE || stripos($string, '<link') !== FALSE)

The code above never finds the match unless I take out the < Do I need to escape that character or something? I tried preg_match('~\b<script\b~',$string) and that failed as well.

I'm sure I'm missing something simple. Any help is greatly appreciated.

Thanks in advance

UPDATE: str_ireplace(array('<script','<link'), array('<replacescript','<replacelink'), $string) does not work either

Upvotes: 0

Views: 130

Answers (0)

Related Questions