3v4l.org

run code in 300+ PHP versions simultaneously
<?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"; } ?>
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 74
Branch analysis from position: 11
2 jumps found. (Code = 46) Position 1 = 32, Position 2 = 39
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 72
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 73
Branch analysis from position: 73
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 72
1 jumps found. (Code = 42) Position 1 = 75
Branch analysis from position: 75
Branch analysis from position: 39
Branch analysis from position: 74
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Jq7U4
function name:  (null)
number of ops:  76
compiled vars:  !0 = $host, !1 = $port, !2 = $socket, !3 = $data, !4 = $info, !5 = $serverName, !6 = $playersOnline, !7 = $playersMax
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '198.24.166.216'
    3     1        ASSIGN                                                   !1, 25565
    4     2        BEGIN_SILENCE                                    ~10     
          3        INIT_FCALL                                               'fsockopen'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $11     
          7        END_SILENCE                                              ~10
          8        ASSIGN                                                   !2, $11
    5     9        TYPE_CHECK                                  1018          !2
         10      > JMPZ                                                     ~13, ->74
    6    11    >   BEGIN_SILENCE                                    ~14     
         12        INIT_FCALL                                               'fwrite'
         13        SEND_VAR                                                 !2
         14        SEND_VAL                                                 '%FE'
         15        DO_ICALL                                                 
         16        END_SILENCE                                              ~14
    7    17        ASSIGN                                                   !3, ''
    8    18        BEGIN_SILENCE                                    ~17     
         19        INIT_FCALL                                               'fread'
         20        SEND_VAR                                                 !2
         21        SEND_VAL                                                 1024
         22        DO_ICALL                                         $18     
         23        END_SILENCE                                              ~17
         24        ASSIGN                                                   !3, $18
    9    25        BEGIN_SILENCE                                    ~20     
         26        INIT_FCALL                                               'fclose'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                                 
         29        END_SILENCE                                              ~20
   10    30        TYPE_CHECK                                  1018  ~22     !3
         31      > JMPZ_EX                                          ~22     ~22, ->39
         32    >   INIT_FCALL                                               'substr'
         33        SEND_VAR                                                 !3
         34        SEND_VAL                                                 0
         35        SEND_VAL                                                 1
         36        DO_ICALL                                         $23     
         37        IS_EQUAL                                         ~24     $23, '%FF'
         38        BOOL                                             ~22     ~24
         39    > > JMPZ                                                     ~22, ->72
   11    40    >   INIT_FCALL                                               'explode'
         41        SEND_VAL                                                 '%A7'
         42        INIT_FCALL                                               'mb_convert_encoding'
         43        INIT_FCALL                                               'substr'
         44        SEND_VAR                                                 !3
         45        SEND_VAL                                                 1
         46        DO_ICALL                                         $25     
         47        SEND_VAR                                                 $25
         48        SEND_VAL                                                 'iso-8859-1'
         49        SEND_VAL                                                 'utf-16be'
         50        DO_ICALL                                         $26     
         51        SEND_VAR                                                 $26
         52        DO_ICALL                                         $27     
         53        ASSIGN                                                   !4, $27
   12    54        INIT_FCALL                                               'substr'
         55        FETCH_DIM_R                                      ~29     !4, 0
         56        SEND_VAL                                                 ~29
         57        SEND_VAL                                                 1
         58        DO_ICALL                                         $30     
         59        ASSIGN                                                   !5, $30
   13    60        FETCH_DIM_R                                      ~32     !4, 1
         61        ASSIGN                                                   !6, ~32
   14    62        FETCH_DIM_R                                      ~34     !4, 2
         63        ASSIGN                                                   !7, ~34
   15    64        ROPE_INIT                                     6  ~37     'Server%3A+'
         65        ROPE_ADD                                      1  ~37     ~37, !5
         66        ROPE_ADD                                      2  ~37     ~37, '%3Cbr%2F%3EPlayers+Online%3A+'
         67        ROPE_ADD                                      3  ~37     ~37, !6
         68        ROPE_ADD                                      4  ~37     ~37, '%2F'
         69        ROPE_END                                      5  ~36     ~37, !7
         70        ECHO                                                     ~36
         71      > JMP                                                      ->73
   18    72    >   ECHO                                                     'Failed+to+receive+data'
         73    > > JMP                                                      ->75
   22    74    >   ECHO                                                     'Failed+to+connect'
   24    75    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.02 ms | 1400 KiB | 27 Q