3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ok { public function t() { $this->replacer( '*' ); return preg_replace_callback( '/(t)/', array( $this, 'replacerx'), 'this is a simple test' ); } private function replacer( $input ) { static $cache = '-'; if ( ! is_array( $input ) ) { $cache = $input; } else { return $cache . $input[1] . $cache; } } } class buggyphp extends ok {} class buggyphptoo extends ok { public function t() { return parent::t(); } } $buggy = new buggyphp(); echo 'Result buggyphp: ' . $buggy->t(); echo "\n"; $buggy = new buggyphptoo(); echo 'Result buggyphptoo: ' . $buggy->t(); echo "\n"; $a = new ok(); echo 'Result ok: ' . $a->t();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7LW7n
function name:  (null)
number of ops:  24
compiled vars:  !0 = $buggy, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $2      'buggyphp'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   25     3        INIT_METHOD_CALL                                         !0, 't'
          4        DO_FCALL                                      0  $5      
          5        CONCAT                                           ~6      'Result+buggyphp%3A+', $5
          6        ECHO                                                     ~6
   26     7        ECHO                                                     '%0A'
   27     8        NEW                                              $7      'buggyphptoo'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !0, $7
   28    11        INIT_METHOD_CALL                                         !0, 't'
         12        DO_FCALL                                      0  $10     
         13        CONCAT                                           ~11     'Result+buggyphptoo%3A+', $10
         14        ECHO                                                     ~11
   29    15        ECHO                                                     '%0A'
   30    16        NEW                                              $12     'ok'
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !1, $12
   31    19        INIT_METHOD_CALL                                         !1, 't'
         20        DO_FCALL                                      0  $15     
         21        CONCAT                                           ~16     'Result+ok%3A+', $15
         22        ECHO                                                     ~16
         23      > RETURN                                                   1

Class ok:
Function t:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7LW7n
function name:  t
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_METHOD_CALL                                         'replacer'
          1        SEND_VAL_EX                                              '%2A'
          2        DO_FCALL                                      0          
    5     3        INIT_FCALL                                               'preg_replace_callback'
          4        SEND_VAL                                                 '%2F%28t%29%2F'
          5        FETCH_THIS                                       ~1      
          6        INIT_ARRAY                                       ~2      ~1
          7        ADD_ARRAY_ELEMENT                                ~2      'replacerx'
          8        SEND_VAL                                                 ~2
          9        SEND_VAL                                                 'this+is+a+simple+test'
         10        DO_ICALL                                         $3      
         11      > RETURN                                                   $3
    6    12*     > RETURN                                                   null

End of function t

Function replacer:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7LW7n
function name:  replacer
number of ops:  12
compiled vars:  !0 = $input, !1 = $cache
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        BIND_STATIC                                              !1
    9     2        TYPE_CHECK                                  128  ~2      !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->7
   10     5    >   ASSIGN                                                   !1, !0
          6      > JMP                                                      ->11
   12     7    >   FETCH_DIM_R                                      ~5      !0, 1
          8        CONCAT                                           ~6      !1, ~5
          9        CONCAT                                           ~7      ~6, !1
         10      > RETURN                                                   ~7
   14    11    > > RETURN                                                   null

End of function replacer

End of class ok.

Class buggyphp:
Function t:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7LW7n
function name:  t
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_METHOD_CALL                                         'replacer'
          1        SEND_VAL_EX                                              '%2A'
          2        DO_FCALL                                      0          
    5     3        INIT_FCALL                                               'preg_replace_callback'
          4        SEND_VAL                                                 '%2F%28t%29%2F'
          5        FETCH_THIS                                       ~1      
          6        INIT_ARRAY                                       ~2      ~1
          7        ADD_ARRAY_ELEMENT                                ~2      'replacerx'
          8        SEND_VAL                                                 ~2
          9        SEND_VAL                                                 'this+is+a+simple+test'
         10        DO_ICALL                                         $3      
         11      > RETURN                                                   $3
    6    12*     > RETURN                                                   null

End of function t

Function replacer:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7LW7n
function name:  replacer
number of ops:  12
compiled vars:  !0 = $input, !1 = $cache
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        BIND_STATIC                                              !1
    9     2        TYPE_CHECK                                  128  ~2      !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->7
   10     5    >   ASSIGN                                                   !1, !0
          6      > JMP                                                      ->11
   12     7    >   FETCH_DIM_R                                      ~5      !0, 1
          8        CONCAT                                           ~6      !1, ~5
          9        CONCAT                                           ~7      ~6, !1
         10      > RETURN                                                   ~7
   14    11    > > RETURN                                                   null

End of function replacer

End of class buggyphp.

Class buggyphptoo:
Function t:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7LW7n
function name:  t
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_STATIC_METHOD_CALL                                  't'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   21     3*     > RETURN                                                   null

End of function t

Function replacer:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7LW7n
function name:  replacer
number of ops:  12
compiled vars:  !0 = $input, !1 = $cache
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        BIND_STATIC                                              !1
    9     2        TYPE_CHECK                                  128  ~2      !0
          3        BOOL_NOT                                         ~3      ~2
          4      > JMPZ                                                     ~3, ->7
   10     5    >   ASSIGN                                                   !1, !0
          6      > JMP                                                      ->11
   12     7    >   FETCH_DIM_R                                      ~5      !0, 1
          8        CONCAT                                           ~6      !1, ~5
          9        CONCAT                                           ~7      ~6, !1
         10      > RETURN                                                   ~7
   14    11    > > RETURN                                                   null

End of function replacer

End of class buggyphptoo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.6 ms | 1404 KiB | 15 Q