3v4l.org

run code in 500+ PHP versions simultaneously
<?php class rotate_filter_nw extends php_user_filter { function filter($in, $out, &$consumed, $closing) { while ($bucket = stream_bucket_make_writeable($in)) { $this->rotate($bucket->data); $consumed += $bucket->datalen; stream_bucket_prepend($out, $bucket); } return PSFS_PASS_ON; } function rotate(&$data) { $n = strlen($data); for ($i = 0; $i < $n - 1; ++$i) { $data[$i] = $data[$i + 1]; } } } stream_filter_register("rotator_notWorking", rotate_filter_nw::class); $stream = fopen('php://memory', 'w+'); fwrite($stream, 'hello, world'); rewind($stream); stream_filter_append($stream, "rotator_notWorking"); var_dump(stream_get_contents($stream));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lQ88Q
function name:  (null)
number of ops:  27
compiled vars:  !0 = $stream
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                                   'stream_filter_register'
          1        SEND_VAL                                                     'rotator_notWorking'
          2        SEND_VAL                                                     'rotate_filter_nw'
          3        DO_ICALL                                                     
   26     4        INIT_FCALL                                                   'fopen'
          5        SEND_VAL                                                     'php%3A%2F%2Fmemory'
          6        SEND_VAL                                                     'w%2B'
          7        DO_ICALL                                             $2      
          8        ASSIGN                                                       !0, $2
   27     9        INIT_FCALL                                                   'fwrite'
         10        SEND_VAR                                                     !0
         11        SEND_VAL                                                     'hello%2C+world'
         12        DO_ICALL                                                     
   28    13        INIT_FCALL                                                   'rewind'
         14        SEND_VAR                                                     !0
         15        DO_ICALL                                                     
   29    16        INIT_FCALL                                                   'stream_filter_append'
         17        SEND_VAR                                                     !0
         18        SEND_VAL                                                     'rotator_notWorking'
         19        DO_ICALL                                                     
   30    20        INIT_FCALL                                                   'var_dump'
         21        INIT_FCALL                                                   'stream_get_contents'
         22        SEND_VAR                                                     !0
         23        DO_ICALL                                             $7      
         24        SEND_VAR                                                     $7
         25        DO_ICALL                                                     
         26      > RETURN                                                       1

Class rotate_filter_nw:
Function filter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 5
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 5
Branch analysis from position: 21
Branch analysis from position: 5
filename:       /in/lQ88Q
function name:  filter
number of ops:  23
compiled vars:  !0 = $in, !1 = $out, !2 = $consumed, !3 = $closing, !4 = $bucket
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV                                                 !2      
          3        RECV                                                 !3      
    7     4      > JMP                                                          ->16
    8     5    >   INIT_METHOD_CALL                                             'rotate'
          6        CHECK_FUNC_ARG                                               
          7        FETCH_OBJ_FUNC_ARG                                   $5      !4, 'data'
          8        SEND_FUNC_ARG                                                $5
          9        DO_FCALL                                          0          
    9    10        FETCH_OBJ_R                                          ~7      !4, 'datalen'
         11        ASSIGN_OP                                         1          !2, ~7
   10    12        INIT_FCALL                                                   'stream_bucket_prepend'
         13        SEND_VAR                                                     !1
         14        SEND_VAR                                                     !4
         15        DO_ICALL                                                     
    7    16    >   INIT_FCALL                                                   'stream_bucket_make_writeable'
         17        SEND_VAR                                                     !0
         18        DO_ICALL                                             $10     
         19        ASSIGN                                               ~11     !4, $10
         20      > JMPNZ                                                        ~11, ->5
   13    21    > > RETURN                                                       2
   14    22*     > RETURN                                                       null

End of function filter

Function rotate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 5
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 5
Branch analysis from position: 13
Branch analysis from position: 5
filename:       /in/lQ88Q
function name:  rotate
number of ops:  14
compiled vars:  !0 = $data, !1 = $n, !2 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E >   RECV                                                 !0      
   18     1        STRLEN                                               ~3      !0
          2        ASSIGN                                                       !1, ~3
   19     3        ASSIGN                                                       !2, 0
          4      > JMP                                                          ->10
   20     5    >   ADD                                                  ~7      !2, 1
          6        FETCH_DIM_R                                          ~8      !0, ~7
          7        ASSIGN_DIM                                                   !0, !2
          8        OP_DATA                                                      ~8
   19     9        PRE_INC                                                      !2
         10    >   SUB                                                  ~10     !1, 1
         11        IS_SMALLER                                                   !2, ~10
         12      > JMPNZ                                                        ~11, ->5
   22    13    > > RETURN                                                       null

End of function rotate

End of class rotate_filter_nw.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
182.28 ms | 3340 KiB | 22 Q