l102/9.4.php

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body style="display: flex;"> <?php $html ="Dit is een <a href='pagina.php'>link</a> met een plaatje: <img src='plaatje.jpg'> " ; $html_stripped = strip($html); echo $html_stripped; function strip($html){ while (strstr($html, "<a")) { $begina = strpos($html, "<a"); $einda = strpos($html, "'>",$begina); $html = substr_replace($html, "", $begina, $einda - $begina+2); $html = str_replace("</a?", "", $html); } while (strstr($html, "<img")){ $beginb = strpos($html, "<img"); $eindb = strpos($html, ">",$beginb); $html = substr_replace($html, "", $beginb, $eindb - $beginb+1); } return $html; } ?> </body> </html> </body> </html>

Resultaat

Made by Thijs Aarnoudse