我试着从给定的字符串中删除第一个单词。到目前为止..。
$word = 'removeMe|meow|whatever';
$needle = 'removeMe';
$haystack = ''; // To replace with.
$word = str_replace( $needle, $haystack, $word );效果很好,但问题是当$word是这样的时候.
$word = 'removeMe|meow|removeMe|whatever';我不想删除第二个$needle。这有可能吗?)
发布于 2011-03-06 12:44:42
试试这个:
$index = strpos($word, '|');
$word = substr($word, 0, $index);https://stackoverflow.com/questions/5210522
复制相似问题