title: php remove "empty" values in array
body: <p>I'm trying to clean an array from empty values by using the following function:</p>
  
  <pre><code>function remove_empty_cells($data)
  {
      $findthis = array("/\r\n/u", "/\n/u", "/\r/u", "/\s+/u", "~\x{00a0}~");
      for($i=0; $i&lt;count($data); $i++)
      {
          $data[$i] = preg_replace($findthis, " ", $data[$i]);
          $data[$i] = htmlspecialchars_decode(htmlspecialchars($data[$i], ENT_SUBSTITUTE, 'UTF-8'));
          if (empty($data[$i]) ||
              mb_strlen($data[$i]) &lt; strlen($data[$i]) ||
              is_null($data[$i]) ||
              $data[$i] = " " ||
              $data[$i] = "" ||
              $data[$i] == "0")
          {
               array_splice($data, $i, 1);
          };//end if
      };//end for
      return $data;
  };//end func
  </code></pre>
  
  <p>The empty values don't go away, I fail to identify them..</p>
  
  <p>the data:</p>
  
  <pre><code>array (
    0 =&gt; '
  ',
    1 =&gt; 'BEGIN:VCARD 
  ',
    2 =&gt; '
  ',
    3 =&gt; '
  ',
    4 =&gt; '
  ',
    5 =&gt; '
  ',
    6 =&gt; '
  ',
    7 =&gt; 'VERSION:2.1 
  ',
  </code></pre>
  
  <p>...
  might be some encoding problem or something.. it doesnt look like multibyte characters..
  the result i get is: </p>
  
  <pre><code>array (
    0 =&gt; 'BEGIN:VCARD 
  ',
    1 =&gt; '
  ',
    2 =&gt; '
  ',
    3 =&gt; 'VERSION:2.1 
  ',
  </code></pre>
  
  <p>...</p>