title: Php implode empty array
body: <p>I have a simple array with no values assigned:</p>
  
  <pre><code>Array
  (
      [field1] =&gt; 
      [field2] =&gt; 
  )
  </code></pre>
  
  <p>then doing something like:</p>
  
  <pre><code>$result = array();
  foreach ($array as $val) {
     array_push($result, $val);
  }
  
  $data = implode("::", $result);
  </code></pre>
  
  <p>I end up with:</p>
  
  <pre><code>::
  </code></pre>
  
  <p>So how can I prevent implode generating separator if array values are empty?
  If I have at least one value assigned:</p>
  
  <pre><code>Array
  (
      [field1] =&gt; "hello"
      [field2] =&gt; 
  )
  </code></pre>
  
  <p>Then implode does it's job fine.</p>