security Posted May 30, 2012 at 11:49 AM Report #459124 Posted May 30, 2012 at 11:49 AM BOAS, eu estou a desenvolver um site (de um clube de futebol) onde aparecem o nome dos sócios, mas a ideia é aparecer apenas o 1º e o ultimo nome, mas na base de dados o nome so tem um campo unico. a ideia era fazer algo do genero Pedro ... Coelho Alguemme pode ajudar??? "Innovation distinguishes between a leader and a follower." Steve jobs.
MASNathan Posted May 30, 2012 at 11:51 AM Report #459126 Posted May 30, 2012 at 11:51 AM Olá... tenta assim $nome= "Pedro Manuel Coelho"; $primeiro_nome= explode(" ", $nome); echo $primeiro_nome[0];
HappyHippyHippo Posted May 30, 2012 at 11:52 AM Report #459127 Posted May 30, 2012 at 11:52 AM maneira rápida sem verificação de número de elementos da string $cut = reset(explode(" ", trim($string)))." ".end(explode(" ", trim($string))); 1 Report IRC : sim, é algo que ainda existe >> #p@p Portugol Plus
MASNathan Posted May 30, 2012 at 11:57 AM Report #459129 Posted May 30, 2012 at 11:57 AM (edited) $cut = reset(explode(" ", trim($string)))." ".end(explode(" ", trim($string))); ya... bem jogado, não sabia dessa cena Edited May 30, 2012 at 11:57 AM by MASNathan
security Posted May 30, 2012 at 01:29 PM Author Report #459142 Posted May 30, 2012 at 01:29 PM muito obrigado... era isto mesmo... embora agora tenha de a trabalhar um pouco... "Innovation distinguishes between a leader and a follower." Steve jobs.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now