title: Get PHP content-type from header()
body: <p>I need to get the content-type of PHP for "security reasons". For example, if you used the function <code>header("Content-type: text/html; charset=utf-8")</code>, how, at a future time of execution, I can receive the content-type (<code>text/html</code>) and charset (<code>utf-8</code>) separately?</p>
  
  <p>My real problem is knowing which charset is being used and modify <em>only</em> it, if necessary, without having to redefine the information <code>Content-type</code>. Ie if content-type is <code>application/xml</code>, keep it, but change the <em>only</em> charset.</p>
  
  <p>Ex.</p>
  
  <pre><code>Original:    Content-type: text/html
  First:       -&gt; set to application/xml.
               Content-type: application/xml
  Second:      -&gt; set charset.
               Content-type: application/xml; charset=utf-8
  Third:       -&gt; set to text/html
               Content-type: text/html; charset=utf-8
  </code></pre>
  
  <p>How it is possible?</p>