3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $host = "198.24.166.216"; $port = 25565; $socket = @fsockopen($host, $port); if ($socket !== false) { @fwrite($socket, "\xFE"); $data = ""; $data = @fread($socket, 1024); @fclose($socket); if ($data !== false && substr($data, 0, 1) == "\xFF") { $info = explode("\xA7", mb_convert_encoding(substr($data,1), "iso-8859-1", "utf-16be")); $serverName = substr($info[0], 1); $playersOnline = $info[1]; $playersMax = $info[2]; echo "Server: $serverName<br/>Players Online: $playersOnline/$playersMax"; } else { // Server did not send back proper data, or reading from socket failed. echo "Failed to receive data"; } } else { // Can't connect. Server is probably down. echo "Failed to connect"; } ?>
Output for 4.3.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Failed to connect
Output for 4.3.0 - 4.3.1

Process exited with code 139.