Pergunta

I have a string like this:

:username!~tHesR5@tHesR5.users.quakenet.org

What i need out of this string is:

~tHesR5@tHesR5.users.quakenet.org

I have already got the username from the string using the following:

        $nick = explode(':',$get[0]);
        $nick = explode('!',$nick[1])
        $nick = $nick[0];

How would i do this properly to retrieve what is after the "!"?

Foi útil?

Solução

Like that...

$strWhoIs = ":username!~tHesR5@tHesR5.users.quakenet.org";

$arrWhois = explode('!', $strWhoIs);
$strFirstPart = $arrWhois[0];
$strSecondPart = $arrWhois[1];

Refer to the documentation: php.net/explode

Outras dicas

$nick = explode(':',$get[0]);
$nick = explode('!',$nick[1])
$username = $nick[1]; // <-- add this line
$nick = $nick[0];

What about $nick = substr( $get[0], 10 ); ?

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top