PHP code example of yehchge / yhighlight
1. Go to this page and download the library: Download yehchge/yhighlight library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
yehchge / yhighlight example snippets
php
declare(strict_types=1);
$hl = new highlight();
// default debug: false
// $hl->setDebug(true);
// default:
// - <span class="hl">
// - </span>
// $hl->setLeftHtml("<div style='background:yellow;'>");
// $hl->setRightHtml("</div>");
$title = "Do you know any funny jokes";
$keywords = array('fun', 'funny', 'joke');
$str = $hl->highlightKeywords($title, $keywords);
echo $str;