PHP remove characters after a specific string for a certain length
<p>I have a string that is:</p>

<pre><code>&lt;p&gt;&lt;img src="../filemanager/image.png?1476187745382"/&gt;&lt;/p&gt; some text ... 
</code></pre>

<p>I would like to remove everything after a <code>.png</code> or <code>.jpg</code> when question mark occurs. The goal is to remove the timestamp added <code>?1476187745382</code> but not the <code>"/&gt;&lt;/p&gt;</code> some text ...</p>

<p>Keeping in mind that the timestamp, will change and the what comes after the the image <code>&gt;</code> will also be different.</p>

<p>I have looked at different solutions, but they all remove either the exact occurrence or everything after a certain character, which is not what I need to do.</p>

<p>This is what I have looked at: </p>

<ol>
<li><a href="https://stackoverflow.com/questions/10746695/php-remove-characters-after-last-occurrence-of-a-character-in-a-string">PHP remove characters after last occurrence of a character in a string</a></li>
<li><a href="https://stackoverflow.com/questions/2588666/remove-portion-of-a-string-after-a-certain-character">Remove portion of a string after a certain character</a></li>
</ol>

<p>Can someone point me to the right direction?</p>