cod*_*ict 42
<?php
// keywords are between *
$str = "PHP is the *best*, its the *most popular* and *I* love it.";
if(preg_match_all('/\*(.*?)\*/',$str,$match)) {
var_dump($match[1]);
}
?>
Run Code Online (Sandbox Code Playgroud)
输出:
array(3) {
[0]=>
string(4) "best"
[1]=>
string(12) "most popular"
[2]=>
string(1) "I"
}
Run Code Online (Sandbox Code Playgroud)