Hello, Please could you tell me why, in the following code, the strip_selected_tags function is working perfectly, but the _replacement($text) is not: function strip_selected_tags($str, $tags = "", $stripContent = false){ preg_match_all("/<([^>]+)>/i",$tags,$allTags,PREG_PATTERN_ORDER); foreach ($allTags[1] as $tag){ if ($stripContent) { $str = preg_replace("/<".$tag."[^>]*>.*<\/".$tag.">/iU","",$str); } $str = preg_replace("/<\/?".$tag."[^>]*>/iU","",$str); } return $str; } function _replacement($text) { $array = array("sabbatical" => "removed", "Wood" => "Tree", "Reporter" => "Journalist"); foreach($array as $original => $replacement) { $text = str_replace($original, $replacement, $text); } return $text; } foreach($wsql->fetch_objects() as $obj){ print _replacement($text); print strip_selected_tags($obj->text, '<a><img>'); } PHP: I would greatly appreciate any help. Thanks
If I change the print _replacement($text); to: print _replacement($obj->text, $text); the replacement works, but the tag strip does not. It's one or the other. How do I make both work together?