Calculate number of lines in a div with its width in PHP
<p>is there a way in PHP to count the lines a string will give with a given width and a given line-height? </p>

<p>For example, if I have this text:<br>
Sed eget lorem lorem. Pellentesque tristique, quam vel fringilla porttitor,<br>
neque elit suscipit nisl, id posuere magna libero congue ante.<br>
= 2 lines</p>

<p>Sed eget lorem lorem. Pellentesque<br>
tristique, quam vel fringilla<br>
porttitor, neque elit suscipit nisl,<br>
id posuere magna libero congue ante.<br>
= 4 lines because the width is not the same</p>

<p>Edit:
My question was not clear.<br>
As Jason McCreary said, I want to create a formula (based on font-size, string length, line-height) with PHP that will get me close.</p>

<p>If someone could send me in the right direction to do that I'd appreciate, because I tried to create that magical formula with no result.</p>

<p>I can't use JavaScript in the page.</p>

<p>Thanks!!!!</p>
