Created
May 19, 2010 03:08
-
-
Save xianhuazhou/405904 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$str = '这是中国和中国的句子,把中国替换成其它的,把中国的替换成另一个'; | |
$str = str_replace('中国的', '<a href="a.php"><中国的</a>', $str); | |
$str = preg_replace('/(中国)([^的])/', '<a href="b.php">$1</a>$2', $str) . "\n"; | |
echo $str; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment