x108/E2.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> <?php function zoekId($string,$id){ $id = "id='$id'"; $temp = strstr($string,$id); $temp = strstr($temp,'>'); $temp = substr_replace($temp,'',0,1); $temp1 = strpos($temp,'<'); $temp = substr_replace($temp,'',$temp1); return $temp; } echo zoekId("<div>Dit is een hele lange tekst waarin <a id='aa'>iets</a> binnen een id zit", 'aa'); ?> </body> </html>

Resultaat

Made by Thijs Aarnoudse