Posted By

o0110o on 10/21/12


Tagged

php String text explode


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

o0110o


Get the text in between more text in a string.


 / Published in: PHP
 

Get the text in between more text in a string. Accepts $content,$start,$end & $is_string as parameters.

  1. function txt_between($content,$start,$end,$is_string=null){
  2. if (!$is_string) { $string = file_content($content); } // Is it a string or a file
  3. $output = explode($start, $string);
  4. if (isset($output[1])){
  5. $r = explode($end, $output[1]);
  6. return $output[0];
  7. }
  8. }

Report this snippet  

You need to login to post a comment.