Why does this keep returning a value of 10? $string = "how many instances of string are in this string";
if(eregi("string", $string, $matches)) { print("Matches: " . count($matches) . ""); } else { print("No Match!!!"); }
Simple. Dump the $matches variable and check out the result:
array(10) { [0]=> string(6) "string" [1]=> bool(false) [2]=> bool(false) [3]=> bool(false) [4]=> bool(false) [5]=> bool(false) [6]=> bool(false) [7]=> bool(false) [8]=> bool(false) [9]=> bool(false) }