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