How do search for characters that I want to end a string in PHP?

  • Thread starter Thread starter Aprilrocks.com
  • Start date Start date
A

Aprilrocks.com

Guest
I’m trying to end a string by finding a string within the existing string and I can’t figure out how.
This is what I have so far:
<?php
$file = file_get_contents (‘example.com/example.txt’);

$find_content = strpos($file,"<begin>" );

$content = substr($file,$find_content);


But I’d like to end the string where $file is = to “<end>”. I’m working with a large number of files and the amount of data between <begin> and <end> largely varies. So is there a way to find “<end>” and cut the string off there?
 
Back
Top