title: Separate array values PHP
body: <p>I would like to separate array values echoed from foreach loop</p>
  
  <pre><code>&lt;?php foreach($qty as $qty2): ?&gt; 
      &lt;?php foreach($qty2 as $q): ?&gt;
           &lt;?php echo implode(",", $q); ?&gt;
      &lt;?php endforeach ?&gt;
  &lt;?php endforeach ?&gt; 
  </code></pre>
  
  <blockquote>
    <p>A PHP Error was encountered</p>
  </blockquote>
  
  <p>Severity: Warning</p>
  
  <p>Message: implode(): Invalid arguments passed</p>
  
  <p>Without adding implode function, my values would normally like this</p>
  
  <pre><code>87 89 78
  </code></pre>
  
  <p>It looks confusing so I would like to output as</p>
  
  <pre><code>  87, 89, 78
  </code></pre>
  
  <p>or</p>
  
  <pre><code>  87 - 89 - 78
  </code></pre>
  
  <p>or    </p>
  
  <pre><code>  (87)(89)(78)
  </code></pre>
  
  <p>The idea is to show the users that they are different values from array</p>
  
  <p>The qty array </p>
  
  <pre><code>  Array ( [0] =&gt; Array ( [qty] =&gt; 24 ) [1] =&gt; Array ( [qty] =&gt; 24 ) [2] =&gt; Array ( [qty] =&gt; 24 ) )
  </code></pre>
  
  <p>Now I tried this </p>
  
  <pre><code>   &lt;?php foreach($qty as $qty2): ?&gt; 
        &lt;?php foreach($qty2 as $q): ?&gt;
            &lt;?php echo $q . " , " ; ?&gt;
         &lt;?php endforeach ?&gt;
     &lt;?php endforeach ?&gt;     
  </code></pre>
  
  <p>Result</p>
  
  <pre><code>  24 , 24 , 24 ,
  </code></pre>
  
  <p>There is always a trailing comma at the end</p>
  
  <p>Any Ideas?</p>