How to Find Next String After the Needle Using Strpos()

前端 未结 3 1679
情话喂你
情话喂你 2021-01-20 09:35

I\'m using PHP strpos() to find a needle in a paragraph of text. I\'m struggling with how to find the next word after the needle is found.

For

3条回答
  •  灰色年华
    2021-01-20 10:29

    Or the "old" way... :-)

    $word = "SCREENSHOT ";
    $pos = strpos($description, $word);
    if($pos!==false){
        $link = substr($description, $pos+strlen($word));
        $link = substr($link, strpos($link, " "));
    }
    

提交回复
热议问题