Witam
Podczas przeglądania skryptów na githubie natknąłem się na takie coś:
function mc_status($host,$port='25565') {
// TODO: implement a way to store data (memcached or MySQL?) - please don't overload target server
$fp = fsockopen($host,$port,$errno,$errstr,$timeout=10
); if(!$fp) die($errstr.$errno); else {
fputs($fp, "\xFE"); // xFE - get information about server $response = '';
$response = str_replace("\x00", "", $response); // remove NULL
//$response = explode("\xFF", $response); // xFF - data start (old version, prior to 1.0?)
$response = explode("\xFF\x16", $response); // data start
$response = $response[1]; // chop off all before xFF (could be done with regex actually)
//echo(dechex(ord($response[0])));
$response = explode("\xA7", $response); // xA7 - delimiter
$timeDiff = $timeEnd-$timeInit;
$response[] = $timeDiff < 0 ? 0 : $timeDiff;
}
return $response;
}
Może mi ktoś wytłumaczyć te linijki?
$response = str_replace("\x00", "", $response); // remove NULL //$response = explode("\xFF", $response); // xFF - data start (old version, prior to 1.0?)
$response = explode("\xFF\x16", $response); // data start