title: Remove white space from text file with line breaks
body: <p>I have a large file with line breaks and spaces. The file has text like as follows</p>
  <pre><code>Ampex 
  
  Baofeng 
  
  JBL 
  
  Pioneer 
  
  Sony 
  
  1 BY ONE 
  </code></pre>
  <p>To read the file i wrote this</p>
  <pre><code>$array = explode(&quot;\n&quot;, file_get_contents('brands.txt'));
  
  foreach($array as $line) {
      
      $html_code = '&lt;div class=&quot;form-check&quot;&gt;
    &lt;input class=&quot;form-check-input&quot; type=&quot;radio&quot; name=&quot;exampleRadios&quot; id=&quot;exampleRadios1&quot; value=&quot;option1&quot; checked&gt;
    &lt;label class=&quot;form-check-label d-flex justify-content-between align-items-center&quot; for=&quot;exampleRadios1&quot;&gt;'.
       $line
      .'&lt;span class=&quot;badge bg-primary rounded-pill&quot;&gt;1&lt;/span&gt;
    &lt;/label&gt;
  &lt;/div&gt;';
  echo $html_code;
  
  echo '&lt;pre&gt;';
  //print_r($line);
  echo '&lt;/pre&gt;';
  }
  </code></pre>
  <p>however my html output has an extra radio with value 1 after output the correct value. How can i output the correct value without the <code>1</code> showing as a radio button value?</p>
  <p><a href="https://i.stack.imgur.com/mjACj.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mjACj.png" alt="enter image description here" /></a></p>