You can put you code in functions.php
where you define the string, for example:
<?php
function get_banner_text() {
$url = $_SERVER["REQUEST_URI"];
if (strpos($url, "bob.")) {
$banner_text = "Welcome to Agent Bob's Portal!";
} else {
$banner_text = "Default text here";
}
return $banner_text;
}
?>
Afterwards for example in header.php
of your theme you could have like:
<div class="banner"><?php echo get_banner_text(); ?></div>