What are the potential pitfalls of using substr_count() in PHP?

The potential pitfall of using substr_count() in PHP is that it is case-sensitive, meaning it will not count occurrences of a substring if the case does not match exactly. To solve this issue, you can use the strtolower() function to convert both the main string and the substring to lowercase before using substr_count().

$string = "Hello World, hello world!";
$substring = "hello";
$count = substr_count(strtolower($string), strtolower($substring));
echo $count; // Output: 2