note 43582 added to function.str-replace
| From: | aidan@php.net | Date: | Sat, 26 Jun 2004 14:53:17 +0000 |
| Subject: | note 43582 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-71784@lists.php.net to get a copy of this message | ||
Simple function for highlighting a needle in text...
http://ircphp.com/users/imho/?file=function.str_highlight.php
For example (the google method of highlighting)
<?php
$text = "Here is some text with a search term";
$needle = "search term";
echo str_highlight($text, $needle);
// Here is some text with a <strong>search term</strong>
?>
You may also change the text to be added:
<?php
echo str_highlight($text, $needle, '[start]', '[end]');
// Here is some text with a [start]search term[end]
?>
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+43582
Delete -- http://master.php.net/manage/user-notes.php?action=delete+43582&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+43582&report=yes
Search -- http://master.php.net/manage/user-notes.php