Guest User

Untitled

a guest
Dec 17th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.21 KB | None | 0 0
  1. function nome_sobrenome($nome_todo) {
  2. $nomes = explode(' ', $nome_todo);
  3. if(count($nomes) === 1) { // caso alguém tenha um só nome
  4. return $nomes[0];
  5. }
  6. return $nomes[0]. ' ' .$nomes[count($nomes) - 1];
  7. }
Add Comment
Please, Sign In to add comment