Truncate sentence right before a hyphen in PHP
<p>I need to find the way to truncate a title right before the hyphen like this:</p>

<pre><code>"This is the title-This is an example"
</code></pre>

<p>So when it is truncated the title will be like this:</p>

<pre><code>"This is the title"
</code></pre>

<p>(Without the <code>"-This is an example"</code> part.)</p>

<p>I think there is a PHP function for that but I didn't find it.</p>
