3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo Module::work('hello world.'), "\n"; echo MyModule::work('hello world.'), "\n"; echo YourModule::work('hello world.'); abstract class Module { private static $mask = '[[[%s]]]'; public static function work($it) { return preg_replace_callback('~\w+~', 'static::replace', $it); } private static function replace($matches) { return sprintf(self::$mask, $matches[0]); } } abstract class MyModule extends Module { protected static $mask = '{{{%s}}}'; } abstract class YourModule extends Module { protected static $mask = '***%s***'; public static function work($it) { return call_user_func('parent::work', $it); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OkKik
function name:  (null)
number of ops:  15
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_STATIC_METHOD_CALL                                  'Module', 'work'
          1        SEND_VAL_EX                                              'hello+world.'
          2        DO_FCALL                                      0  $0      
          3        ECHO                                                     $0
          4        ECHO                                                     '%0A'
    3     5        INIT_STATIC_METHOD_CALL                                  'MyModule', 'work'
          6        SEND_VAL_EX                                              'hello+world.'
          7        DO_FCALL                                      0  $1      
          8        ECHO                                                     $1
          9        ECHO                                                     '%0A'
    4    10        INIT_STATIC_METHOD_CALL                                  'YourModule', 'work'
         11        SEND_VAL_EX                                              'hello+world.'
         12        DO_FCALL                                      0  $2      
         13        ECHO                                                     $2
   31    14      > RETURN                                                   1

Class Module:
Function work:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OkKik
function name:  work
number of ops:  8
compiled vars:  !0 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%7E%5Cw%2B%7E'
          3        SEND_VAL                                                 'static%3A%3Areplace'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
   12     7*     > RETURN                                                   null

End of function work

Function replace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OkKik
function name:  replace
number of ops:  9
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'sprintf'
          2        FETCH_STATIC_PROP_R          global lock         ~1      'mask'
          3        SEND_VAL                                                 ~1
          4        FETCH_DIM_R                                      ~2      !0, 0
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   16     8*     > RETURN                                                   null

End of function replace

End of class Module.

Class MyModule:
Function work:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OkKik
function name:  work
number of ops:  8
compiled vars:  !0 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'preg_replace_callback'
          2        SEND_VAL                                                 '%7E%5Cw%2B%7E'
          3        SEND_VAL                                                 'static%3A%3Areplace'
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $1      
          6      > RETURN                                                   $1
   12     7*     > RETURN                                                   null

End of function work

Function replace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OkKik
function name:  replace
number of ops:  9
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'sprintf'
          2        FETCH_STATIC_PROP_R          global lock         ~1      'mask'
          3        SEND_VAL                                                 ~1
          4        FETCH_DIM_R                                      ~2      !0, 0
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   16     8*     > RETURN                                                   null

End of function replace

End of class MyModule.

Class YourModule:
Function work:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OkKik
function name:  work
number of ops:  6
compiled vars:  !0 = $it
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
   29     1        INIT_USER_CALL                                1          'call_user_func', 'parent%3A%3Awork'
          2        SEND_USER                                                !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
   30     5*     > RETURN                                                   null

End of function work

Function replace:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OkKik
function name:  replace
number of ops:  9
compiled vars:  !0 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        INIT_FCALL                                               'sprintf'
          2        FETCH_STATIC_PROP_R          global lock         ~1      'mask'
          3        SEND_VAL                                                 ~1
          4        FETCH_DIM_R                                      ~2      !0, 0
          5        SEND_VAL                                                 ~2
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   16     8*     > RETURN                                                   null

End of function replace

End of class YourModule.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.18 ms | 1404 KiB | 17 Q