Question

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 "!"?

Was it helpful?

Solution

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

OTHER TIPS

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top