在PHP中剥离字母

时间:2010-08-17 07:16:40

标签: php strip

我们有文字变量:

$text = 'I use something similar to pull the most recent post from my blog and display a snapshot of it on my home page.';

如何剥离此文本的前40个符号?(包括空格)。

应该像这样工作:

echo strip_text($text, 40);

感谢。

2 个答案:

答案 0 :(得分:2)

使用substr

echo substr($text, 40);

答案 1 :(得分:-1)

使用PHP的substr

$stripped = substr($text, 0, 40);