如何提取文本并在该用户文本的末尾添加一组字符?

时间:2013-04-01 15:41:30

标签: php regex preg-replace preg-match

示例:

if: $text="youtube.com/video"

我想在该文本的末尾添加类似“example”的内容。

制作:

youtube.com/videoexample

2 个答案:

答案 0 :(得分:2)

有什么问题
$text .= "example";

答案 1 :(得分:1)

可能你正在寻找类似这样的东西ih php:

<?php
if( $text == "youtube.com/video" )
{
    $text = $text . 'example';
}
?>

.是连接其操作数字符串的连接运算符。