PHP如何从短语中删除特定的字符串/单词?

时间:2014-11-06 06:56:06

标签: php

这组字符串来自我的xml feed。我想从PROPERTY FEATURES中删除部分:到最后。我非常需要你的帮助。

Semi fitted office for sale in Tower with partition and kichen

    PROPERTY FEATURES: 
    -Basement parking 
    -Central air conditioning 
    -Covered parking

应该是......

Semi fitted office for sale in Tower with partition and kichen

感谢。任何帮助将不胜感激。

2 个答案:

答案 0 :(得分:0)

$foundAt = strpos($string, 'PROPERTY FEATURES');
$new = substr($string,0,$foundAt);
echo $new;

答案 1 :(得分:0)

尝试:

$str = '//your string';
$new = substr($str, 0, strpos($str, 'PROPERTY'));
var_dump($new);