A: 

You have to add to the $replaced var, now you are overwriting the variable.

    <?php

    $text = "<html><body><pre>
    Here is Foo in text.
    Now come Baz? and Bar-X.
    Replace nothing here: Foo (followed by brackets).
    </pre></body></html>";

    $s = array(
      array("t" => "Foo", "u" => "http://www.foo.com", "c" => "foo"),
      array("t" => "Baz?", "u" => "http://www.baz.net", "c" => "test"),
      array("t" => "Bar-X", "u" => "http://www.baz.org", "c" => "test")
     );

    $replaced = $text;
    foreach ($s as $i => $row) {
      $replaced = preg_replace('/(?=\Q'.$row["t"].'\E[^(]+$)\b\Q'.$row["t"].'\E\b/m',
                               '<a href="'.$row["u"].'" class="'.$row["c"].'">'.$row["t"].'</a>',
                               $replaced );
     }
    echo $replaced;

    ?>
WesleyE
eh. thanks, that was a nice little lesson :)
Martin