title: How to add only non empty arrays to an array?
body: <p>I want avoid several <code>if</code>s and my question is:</p>
  
  <p>Is there a function or a way to add several arrays ($a, $b) to an array, but only if an array ($a, $b) is not empty?</p>
  
  <p>Given:</p>
  
  <pre><code>$a = ['foo' =&gt; 'bar'];
  $b = [];
  </code></pre>
  
  <p>My code:</p>
  
  <pre><code>$c = [];
  
  if (count($a))
  {
    $c['a'] = $a;
  }
  
  if (count($b))
  {
    $c['b'] = $b;
  }
  </code></pre>
  
  <p>Yes, I need string keys with a specific name.</p>