$str = "this is a string";
var_dump( substr_count($str, "t", "5") );
var_dump( substr_count($str, "t", "5", "10") );
-var_dump( substr_count($str, "i", "5t") );
-var_dump( substr_count($str, "i", "5t", "10t") );
echo "\n-- 3rd or 4th arg as NULL --\n";
var_dump( substr_count($str, "I", NULL) );
echo "Done\n";
?>
---EXPECTF--
+--EXPECT--
*** Testing possible variations ***
-- 3rd or 4th arg as string --
int(1)
int(1)
-Notice: A non well formed numeric value encountered in %s on line %d
-int(2)
-
-Notice: A non well formed numeric value encountered in %s on line %d
-
-Notice: A non well formed numeric value encountered in %s on line %d
-int(2)
-
-- 3rd or 4th arg as NULL --
int(0)
int(2)