<?php
//zch: see the SOURCE CODE of the page generated with this
// remember \n doesn't generates a carriage return in html ...
$search = "some text";
$str = sprintf("some text: some text some other text\nsome text: some text some other text\nsome text: some text some other text");
$tok = strtok($str, sprintf("\n"));
while($tok !== false){
$text .= preg_replace("/^(" . $search . ")/", "<b>" . $search . "</b>", $tok);
$text .= sprintf("\n");
$tok = strtok("\n");
}
echo $text;
//echo preg_replace("/^(some text)/", "<b>some text</b>", $str);
?>