title: implode first element in associative array
body: <p>I have one index array which contain associative array. Like this </p>
  
  <pre><code>$arr = array(
              array("id" =&gt; 1,"name" =&gt; "student1"),
              array("id" =&gt; 2,"name" =&gt; "student2"),
              array("id" =&gt; 3,"name" =&gt; "student3"),
          );
  </code></pre>
  
  <p>Now I want output like this </p>
  
  <pre><code>1,2,3 // output
  </code></pre>
  
  <p>I have solution for it but I am searching for better way to do that. Here it is</p>
  
  <pre><code>$ids = "";
  for($i=0;$i&lt;count($arr);$i++)
  {
      $ids .= $arr[$i]['id'].",";
  }
  
  $ids = rtrim($ids,",");
  echo $ids; // output : 1,2,3
  </code></pre>
  
  <p>Is there any better way to achieve it?</p>
  
  <p>Thanks in advance</p>