Skip to content

Instantly share code, notes, and snippets.

@galvao
Last active August 29, 2015 14:01
Show Gist options
  • Save galvao/0b9951c2b6292e2c5257 to your computer and use it in GitHub Desktop.
Save galvao/0b9951c2b6292e2c5257 to your computer and use it in GitHub Desktop.
<?php
// =P
$a = array('Chelsea', 'Liverpool', 'Manchester United', 'Manchester City');
$b = array('e', array_pop($a));
echo implode(', ', $a) . ' ' . implode(' ', $b);
@rafajaques
Copy link

<?php
$a = array('Chelsea', 'Liverpool', 'Manchester United', 'Manchester City');
$last =  ' e ' . array_pop($a);

echo implode(', ', $a) . $last;

@galvao
Copy link
Author

galvao commented May 27, 2014

Frescura, mas prefiro o $last isolado como elemento 🎱

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment