Warning: preg_match_all(): Unknown modifier 'h' in
Notice: Trying to access array offset on value of type null in
Warning: Invalid argument supplied for foreach() in
Notice: Trying to access array offset on value of type null in
Warning: Invalid argument supplied for foreach() in
Hatalarını almaktayım. Veriyi getiriyor h leri doğru sıralıyor fakat ilk forwach yanlış dönüyor
@adwerd0z1;
preg_match_all('/<h[1-6]>(.*?)<\/h[1-6]>/', $content, $cikti);
if (!empty($cikti[0])) {
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];
$newElement = '<h' . ($key + 1) . ' id="' . seo($title) . '">' . $title . '</h' . ($key + 1) . '>';
$content = str_replace($element, $newElement, $content);
}
}