What about this code breaks PHP4?
<p>This code is part of a wordpress plugin. THe page breaks somewhere in the 2nd function and halts output of the page at that point.</p>

<p>I've determined the problem is PHP4 in all likelyhood. So I'm guessing its DOMDocument call if that's not supported by PHP4.</p>

<p>If so, how can I test for compatibility and gracefully exit without try/catch and without freezing the page?</p>

<pre><code>function rseo_get_seo($check, $post){
    switch ($check)
    {
    case "h1": return rseo_doTheParse('h1', $post);
    case "h2": return rseo_doTheParse('h2', $post);
    case "h3": return rseo_doTheParse('h3', $post);
    case "img-alt": return rseo_doTheParse('img-alt', $post);
    }
}

function rseo_doTheParse($heading, $post){
//code breaks somewhere in here and freezes output of page. How can I error check this without try/catch?
    $content = $post-&gt;post_content;
    if($content=="") return false;
    $keyword = trim(strtolower(rseo_getKeyword($post)));
    @$dom = new DOMDocument;
    @$dom-&gt;loadHTML(strtolower($post-&gt;post_content));
    $xPath = new DOMXPath(@$dom);
    switch ($heading)
        {
        case "img-alt": return $xPath-&gt;evaluate('boolean(//img[contains(@alt, "'.$keyword.'")])');
        default: return $xPath-&gt;evaluate('boolean(/html/body//'.$heading.'[contains(.,"'.$keyword.'")])');
        }
}
</code></pre>
