please understand my problem before mark it as a duplicate, i know how to highlight multiple characters in a string, but it works only for English Characters, but i am looking same for the string built in chinese. Mean to say, how to highlight the specific chinese characters from a string.
Example: let's say if i have some specific words:
words: 各領域,頂尖,職涯,生涯,老生常談,陳腔濫調
and here is the content:
string: 但在今天的時候你要控制好自己的情緒與嘴巴,看看第二天你是否還那麼覺得。」 在今年波克夏・海瑟威公司的股東大會中,巴菲特告訴一位好奇的七年級學生說
now how to highlight the words in the given string?
Please help me to sort out this problem
you can use preg_match
:
<?php
$str = "但在今天的時候你要控制好自己的情緒與嘴巴,看看第二天你是否還那麼覺得。」 在今年波克夏・海瑟威公司的股東大會中,巴菲特告訴一位好奇的七年級學生說";
$check = preg_match("/各領域,頂尖,職涯,生涯,老生常談,陳腔濫調/", $str);
echo $check;
?>