3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fwrite_with_retry($sock, &$data) { $bytes_to_write = strlen($data); $bytes_written = 0; while ( $bytes_written < $bytes_to_write ) { if ( $bytes_written == 0 ) { $rv = fwrite($sock, $data); } else { $rv = fwrite($sock, substr($data, $bytes_written)); } if ( $rv === false || $rv == 0 ) return( $bytes_written == 0 ? false : $bytes_written ); $bytes_written += $rv; } return $bytes_written; } $fp = fsockopen("3v4l.org", 80, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "GET / HTTP/1.1\r\n"; $out .= "Host: 3v4l.org\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite_with_retry($fp, $out); while (!feof($fp)) { echo fgets($fp, 128); } fclose($fp); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 16
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 24
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 24
Branch analysis from position: 34
Branch analysis from position: 24
filename:       /in/1Yhvc
function name:  (null)
number of ops:  38
compiled vars:  !0 = $fp, !1 = $errno, !2 = $errstr, !3 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   INIT_FCALL                                               'fsockopen'
          1        SEND_VAL                                                 '3v4l.org'
          2        SEND_VAL                                                 80
          3        SEND_REF                                                 !1
          4        SEND_REF                                                 !2
          5        SEND_VAL                                                 30
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !0, $4
   25     8        BOOL_NOT                                         ~6      !0
          9      > JMPZ                                                     ~6, ->16
   26    10    >   ROPE_INIT                                     4  ~8      !2
         11        ROPE_ADD                                      1  ~8      ~8, '+%28'
         12        ROPE_ADD                                      2  ~8      ~8, !1
         13        ROPE_END                                      3  ~7      ~8, '%29%3Cbr+%2F%3E%0A'
         14        ECHO                                                     ~7
         15      > JMP                                                      ->37
   28    16    >   ASSIGN                                                   !3, 'GET+%2F+HTTP%2F1.1%0D%0A'
   29    17        ASSIGN_OP                                     8          !3, 'Host%3A+3v4l.org%0D%0A'
   30    18        ASSIGN_OP                                     8          !3, 'Connection%3A+Close%0D%0A%0D%0A'
   31    19        INIT_FCALL                                               'fwrite_with_retry'
         20        SEND_VAR                                                 !0
         21        SEND_REF                                                 !3
         22        DO_FCALL                                      0          
   32    23      > JMP                                                      ->29
   33    24    >   INIT_FCALL                                               'fgets'
         25        SEND_VAR                                                 !0
         26        SEND_VAL                                                 128
         27        DO_ICALL                                         $14     
         28        ECHO                                                     $14
   32    29    >   INIT_FCALL                                               'feof'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                         $15     
         32        BOOL_NOT                                         ~16     $15
         33      > JMPNZ                                                    ~16, ->24
   35    34    >   INIT_FCALL                                               'fclose'
         35        SEND_VAR                                                 !0
         36        DO_ICALL                                                 
   36    37    > > RETURN                                                   1

Function fwrite_with_retry:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 6
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 14
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
2 jumps found. (Code = 47) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 34
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 32
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 33
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 6
Branch analysis from position: 37
Branch analysis from position: 6
Branch analysis from position: 27
Branch analysis from position: 14
2 jumps found. (Code = 47) Position 1 = 25, Position 2 = 27
Branch analysis from position: 25
Branch analysis from position: 27
filename:       /in/1Yhvc
function name:  fwrite_with_retry
number of ops:  39
compiled vars:  !0 = $sock, !1 = $data, !2 = $bytes_to_write, !3 = $bytes_written, !4 = $rv
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    4     2        STRLEN                                           ~5      !1
          3        ASSIGN                                                   !2, ~5
    5     4        ASSIGN                                                   !3, 0
    7     5      > JMP                                                      ->35
    9     6    >   IS_EQUAL                                                 !3, 0
          7      > JMPZ                                                     ~8, ->14
   10     8    >   INIT_FCALL                                               'fwrite'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                         $9      
         12        ASSIGN                                                   !4, $9
         13      > JMP                                                      ->23
   12    14    >   INIT_FCALL                                               'fwrite'
         15        SEND_VAR                                                 !0
         16        INIT_FCALL                                               'substr'
         17        SEND_VAR                                                 !1
         18        SEND_VAR                                                 !3
         19        DO_ICALL                                         $11     
         20        SEND_VAR                                                 $11
         21        DO_ICALL                                         $12     
         22        ASSIGN                                                   !4, $12
   15    23    >   TYPE_CHECK                                    4  ~14     !4
         24      > JMPNZ_EX                                         ~14     ~14, ->27
         25    >   IS_EQUAL                                         ~15     !4, 0
         26        BOOL                                             ~14     ~15
         27    > > JMPZ                                                     ~14, ->34
   16    28    >   IS_EQUAL                                                 !3, 0
         29      > JMPZ                                                     ~16, ->32
         30    >   QM_ASSIGN                                        ~17     <false>
         31      > JMP                                                      ->33
         32    >   QM_ASSIGN                                        ~17     !3
         33    > > RETURN                                                   ~17
   18    34    >   ASSIGN_OP                                     1          !3, !4
    7    35    >   IS_SMALLER                                               !3, !2
         36      > JMPNZ                                                    ~19, ->6
   21    37    > > RETURN                                                   !3
   22    38*     > RETURN                                                   null

End of function fwrite_with_retry

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.45 ms | 1398 KiB | 26 Q