How can you extract all content between "href=" and " " from a string in PHP?

To extract all content between "href=" and " " from a string in PHP, you can use a combination of the strpos() and substr() functions to find the starting and ending positions of the content, and then extract the substring in between.

$string = '<a href="https://www.example.com">Link</a>';
$start = strpos($string, 'href="') + 6;
$end = strpos($string, '"', $start);
$content = substr($string, $start, $end - $start);
echo $content;