<?php
preg_match_all('/<h[1-6]>(.*?)</h[1-6]>/', $content, $cikti);
foreach($cikti[1] as $title) {
echo '<a href="#' . seo($title) . '" onclick="goAnchor(' . seo($title) . ')">' . $title . '</a>' . "<br>";
}
foreach ($cikti[0] as $key => $element) {
$title = $cikti[1][$key];
$eski_tag = $element;
$yeni_tag = "<h$key id='" . seo($title) . "'>";
$content = str_replace($eski_tag, $yeni_tag . $title . "</h$key>", $content);
}