How to change color of link if url destination page does not exist
<p>I am making a simple wiki-style site.
I have some text in database and want to make links with [link] tag.</p>

<pre><code>$text = preg_replace('@\[(.*) (.*)\]@', '&lt;a href="\\1" &gt;\\2&lt;/a&gt;', $text);
</code></pre>

<p>Now I want to change color of the link if the destination page does not exist.
How it can be done?</p>

<p>If I insert php code in preg_replace like this: </p>

<pre><code>$text = preg_replace('@[(.*) (.*)]@', '&lt;a href="\\1" class="&lt;?php Wiki::urlchecker($\\1) ?&gt;"&gt;\\2&lt;/a&gt;', $text); 


it doesnt work, generates:
&lt;a href="link" class="&lt;?php Wiki::urlchecker($link) ?&gt;"&gt;Name&lt;/a&gt;
</code></pre>
