# Lower Case, TRIM if (isset($_GET['name1'])) { $NAME1 = $_GET['name1']; $NAME1 = trim($NAME1); $NAME1 = strtolower($NAME1); $NAME1 = str_replace(" ","-",$NAME1); } # String Replace $value = str_replace("Tintic","Mesquite",$value); # Count number of occurances $cnt1 = substr_count($output,"Tintic"); echo "
COUNT: $cnt1"; # Split String into Array $array1 = explode("\n",$output); foreach ($array1 as $value) { $cnt1 = substr_count($value,"Tintic"); #echo "
COUNT: $cnt1"; if ($cnt1 <> 0) { echo "
$value"; } }