get a string before the first “.” with php

前端 未结 5 559
执念已碎
执念已碎 2021-01-14 21:40

\"Lorem Ipsum is simply dummy text of the printing and typesetting industry.\"

from

\"Lorem Ipsum is simply dummy text of the printing and typesetting indust

5条回答
  •  伪装坚强ぢ
    2021-01-14 21:52

    You can split it using the explode() function.

    $sentences = explode (".", $text);
    // first sentence is in $sentences[0]
    

提交回复
热议问题