I have a string variable that contains a lot of HTML markup and I want to get the last `
` element from it.
Im using something like:
$markup = "
#ims', $markup, $matches);
$lis = "
$total = explode("",$lis);
$num = count($total)-2;
This works and I get the last `
` element printed. But I cant understand why I have to subtract the last 2 indexes of the array `$total`. Normally I would only subtract the last index since counting starts on index 0. What im i missing?
Is there a better way of getting the last `
` element from the string? isnt $lis value waht you want ? it seems to me that you get the same result