title: How do I create a comma-separated list from an array in PHP?
body: <p>I know how to loop through items of an array using foreach and append a comma, but it's always a pain having to take off the final comma. Is there an easy PHP way of doing it?</p>
  
  <pre><code>$fruit = array('apple', 'banana', 'pear', 'grape');
  </code></pre>
  
  <p>Ultimately I want</p>
  
  <pre><code>$result = "apple, banana, pear, grape"
  </code></pre>