Parsing URLs: removing a character from string
<p>I am currently trying to format url links with <code>parse_url</code>. My goal is to parse the link every time it has the following characters <code>&amp;p</code> (in that order)  in it. The <code>if statement</code> is there to check for these characters the in the <code>url</code> before deciding to parse the link or not. For example, if the link has the characters <code>&amp;p</code> (in that order) then it will parse the link and format to my desired choice. I have been able to figure the parsing part but how would I be able to check for these characters <code>&amp;p</code> (in that order)? If you see below example, I only want to remove <code>&amp;</code> from the link.</p>

<pre><code>if($url == '&amp;p' ) // not sure how to check
{
$parsed_url = parse_url($url);
$fragment = $parsed_url['fragment'];
$fragment_parts = explode('/', $fragment);
$formatted_url = array_pop('http://www.website.com?p=$1',$url);
}
else    
{   
// do something else
}
</code></pre>

<p><strong>Example:</strong></p>

<p>Input: <code>http://www.website.com?&amp;p=107</code></p>

<p>Output: <code>'http://www.website.com?p=107</code></p>
