方法一
//假定以“;”为每组词的分割符
03 $text = 'a->b;b->a;c->a;a->c';
04 $arr = explode(";", $text);
05 $arrSorted = array();
06 foreach($arr as $str) {
07 list($front, $back) = explode("->", $str);
08 //将唯一的字符串保存在$arrSorted的键值里
09 if (!isset($arrSorted[$front.$back]) and !isset($arrSorted[$back.$front])) {
10 $arrSorted[$front.$back] = $front.'->'.$back;
11 }
12 }
13 //打印
14 foreach($arrSorted as $str) {
15 echo $str . '
';
16 }
方法二
$reg1 = 'a->b';
$content; //这里是你所有的内容
preg_match_all($reg1, $content, $match); //这里得到的是所有的'a->b'的内容存为数组
preg_replace($reg1, '', $match);

热AI工具

Undresser.AI Undress
人工智能驱动的应用程序,用于创建逼真的裸体照片

AI Clothes Remover
用于从照片中去除衣服的在线人工智能工具。

Undress AI Tool
免费脱衣服图片

Clothoff.io
AI脱衣机

Video Face Swap
使用我们完全免费的人工智能换脸工具轻松在任何视频中换脸!

热门文章

热工具

SublimeText3 英文版
推荐:为Win版本,支持代码提示!

Dreamweaver CS6
视觉化网页开发工具

SublimeText3 Mac版
神级代码编辑软件(SublimeText3)

SublimeText3 Linux新版
SublimeText3 Linux最新版

ZendStudio 13.5.1 Mac
功能强大的PHP集成开发环境