Search code examples
phpirc

explode() and return data


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


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