The problem is that you wrote $tags['$2'], and PHP thinks you want to call the index '$2' in the $tags array...
You have to use the "e" modifier...
$html = preg_replace ('/(<)([A-Za-z]+)(>)/e', '"<" . $tags["$2"] . ">"', $html);
Also, I noticed this will only affect opening tags, not closing tags... so use this :
$html = preg_replace ('/(<)(\/?)([A-Za-z]+)(>)/e', '"<$2" . $tags["$3"] . ">"', $html);