Example of a $text
variable:
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
Splitting it in half:
$half = strlen($text) / 2;
will get me to the o
character in consequat
.
How can I find the position of the nearest sentence delimiter (dot) in the middle of the text? In this example it's 7 characters after that o
.
Also this text contains HTML code.
I want to ignore the HTML when finding out the half-point of the text, and ignore dots from within html attributes etc.