'str_contains returns true, but preg_match returns false
I am getting the HTML code of this website -
with this code $html = file_get_contents($url)
and then I am running a simple regex which does not work and I have no idea why.
This code output - FALSE
preg_match('/actor/miu', $html);
and this code output - TRUE
str_contains($html, 'actor');
Do you know where it could be the reason I checked the HTML several times. It is the correct HTML.
Solution 1:[1]
This page has problems with unicode.
Try preg_match('/actor/mi', $html);
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Klamber |
