Advertisement
Guest User

Untitled

a guest
Jun 24th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. <?php
  2. $content = 'Lorem Ipsum is simply dummy text <remove this part and all content after first <';
  3. $content = substr($content, 0, strpos($content, "<"));
  4.  
  5. // will display: Lorem Ipsum is simply dummy text
  6. print_r($content);
  7.  
  8. // another example we need only output after specified word
  9. $content = 'Lorem Ipsum is simply dummy text remove this part and all content after "remove" word';
  10. $content = substr($content, 0, strpos($content, "remove"));
  11.  
  12. // will display: Lorem Ipsum is simply dummy text
  13. print_r($content);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement