need to find the position of the first html tag without </ after the word togowentgone
$a = '<p>hi</p><p>togowentgone</p> <br />'
here it would be <br />
// position=30
$b = '<br /><strong><p>togowentgone</p></strong> <hr />'
here it would be <hr />
// position=44
could you please give me a clue?
detect first html tag
Moderator: General Moderators
Re: detect first html tag
Code: Select all
$string = "<p><strong>togowentgone</strong></p> <hr />";
$needle = "togowentgone";
$start = stripos($string, '<', stripos($string, $needle));
while (substr($string, $start + 1, 1) == '/')
{
$start = stripos($string, '<', $start + 1);
}
echo $start;