Get the text in between more text in a string.


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  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


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.