$html_content = str_replace($patterns, $rep, $html_content); return $html_content; } function addbraces(&$it) { return $it = "{{" . $it . "}}"; } function generate_xhtml($html) { $xhtml = <<<XHTML <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <meta charset="utf-8" /> <html xmlns="http://www.w3.org/1999/xhtml"> {myhtml} XHTML; $retxhtml = str_replace("{myhtml}", $html, $xhtml); return $retxhtml; } function my_pre($var) { echo "<pre>" . print_r($var, true); } } $weatherApi = new WeatherAPI(); $wobject = $weatherApi->parse_xml($question1->url); $parse_array = $weatherApi->get_key_array($wobject); $html = $weatherApi->get_weather_html_from_template($parse_array); echo $final_xhtml = $weatherApi->generate_xhtml($html);