title: Separate an array with comma and string PHP
body: <p>I want to separate an array with comma and word.</p>
  
  <p>This is the code that i make:</p>
  
  <pre><code>$array = array( 'user1', 'user2', 'user3', 'user4', 'user5' );
  $last = array_pop( $array );
  $string = count( $array ) ? implode( ", ", $array ) . " and " . $last : $last;
  
  printf( 'Authors: %s', $string );
  </code></pre>
  
  <p>My code print this:</p>
  
  <p>Authors: user1, user2, user3, user4 and user5</p>
  
  <p>I successfully made a code to implode the array with a comma and search for the last key and separate it with a word 'and'.</p>
  
  <p>But that's what I want but I failed after more than 2 days of work on this:</p>
  
  <p>Authors: user1, user2, and user3 and 2 others.</p>