function clean($string) { while(strstr($string, " ")) { $string = str_replace(" ", " ", $string); } return $string; } function php($function) { $html = file_get_contents("http://php.net/$function"); $html = str_replace("\n", "", $html); preg_match("/
(.*?)<\/p>

(.*?)<\/p><\/div>

Description<\/h2>(.*?)

(.*?)<\/p>

/", $html, $matches); if (!$matches[1]) { return FALSE; } else { for ($x = 1; $x < 5; $x++) { $return[($x-1)] = clean(str_replace("—", "--", html_entity_decode(strip_tags(trim($matches[$x]))))); } $return[4] = "Url: http://php.net/".str_replace(" ", "_", $function); return $return; } }