title: Remove white spaces between tags in HTML
body: <p>I am using the following code to remove white spaces in html. I only want to remove white spaces in betweens tags. But below code replaces all white spaces</p>
  
  <p>I.E remove all white spaces in between ">" and "&lt;"</p>
  
  <pre><code>//read the entire string
  $str=file_get_contents('sample.txt');
  
  //replace all white spaces
  $str=str_replace("\n", "",$str);
  $str=str_replace("\t", "",$str);
  $str=str_replace(" ", "",$str);
  
  //write the entire string
  file_put_contents('sample.txt', $str);
  </code></pre>