You can make a good use of preg_match function:
$str = '<p style="text-align:center">
<a href="#" target="_blank"><span style="color:green">Text Link</span></a>
</p>';
if(preg_match('/^(\<p.*?\>).*(\<a.*?\>).*(\<span.*?\>)([0-9a-zA-Z ]*).*$/is', $str, $regs))
{
// $regs = [
// 0 => ... (original string)
// 1 => '<p style="text-align:center">',
// 2 => '<a href="#" target="_blank">',
// 3 => '<span style="color:green">',
// 4 => 'Text Link']
$newStr = $regs[1].$regs[3].$regs[2].$regs[4].'</a></span></p>';
}
You may have to change the [0-9a-zA-Z ]* in regular expression to match your links format.
If input HTML is multiple line text then you have to use s modifier after the regular exception, I also used i as case insensitive just to be sure noone mixed <P> and <p> tag together and so on...
Note that this if fairly specific solution and for more general solution you should use something like loading HTML into DOM and working with nodes, but this is pretty simple and quick solution for this particular case.