extract url from a hyperlinked string in PHP [closed]

$arr_str = new SimpleXMLElement('<a href="www.example.com">Click here</a>');
echo $arr_str['href']; // will echo www.example.com

Note that, SimpleXMLElement required PHP version above 5.

tech