3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function bartz_online($ip, $port){ $fs=@fsockopen($ip, $port, $ERROR_NO, $ERROR_STR, 3); $pck=pack("vCi",7,0x00,-3); fwrite($fs,$pck); $r=fread($fs,73); fclose($fs); $a=unpack("vsize/Cid/iworld/imax/icurrent/iplaying/istore",$r); return $a; } function print_online($ip, $port, $name){ $a = bartz_online($ip, $port); printf("ServerName: %s - Current: %d - Store: %d - Max %d\n", $name, $a['playing'], $a['store'], $a['max']); } print_online('185.30.164.11','7777','L2-Toxic'); //$fp = fopen('online.txt', 'a'); //fwrite($fp, bartz_online()); //fclose($fp); ?>
Output for 5.3.0 - 7.1.0
Warning: fwrite() expects parameter 1 to be resource, boolean given in /in/HDTUa on line 6 Warning: fread() expects parameter 1 to be resource, boolean given in /in/HDTUa on line 7 Warning: fclose() expects parameter 1 to be resource, boolean given in /in/HDTUa on line 8 Warning: unpack(): Type v: not enough input, need 2, have 0 in /in/HDTUa on line 9 ServerName: L2-Toxic - Current: 0 - Store: 0 - Max 0
Output for 4.3.2 - 5.2.17
Warning: fwrite(): supplied argument is not a valid stream resource in /in/HDTUa on line 6 Warning: fread(): supplied argument is not a valid stream resource in /in/HDTUa on line 7 Warning: fclose(): supplied argument is not a valid stream resource in /in/HDTUa on line 8 Warning: unpack(): Type v: not enough input, need 2, have 0 in /in/HDTUa on line 9 ServerName: L2-Toxic - Current: 0 - Store: 0 - Max 0
Output for 4.3.0 - 4.3.1

Process exited with code 139.