PHP function to extract a string inside a string given a start and end point.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

PHP String Extract

String Extract PHP can be used to extract a string from within another string, given a start and end point. Useful for certain web scraping tasks.


$string = '<h1>Hello World!</h1>';

$extract = stringExtract($string, '<h1>', '</h1>');

echo $extract;  // Echoes “Hello World!”

If successful, the function will return the desired string. If unsuccessful, the function will return false.