문제

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

도움이 되었습니까?

해결책

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

다른 팁

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

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top