3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo Module::work('hello world.'), "\n"; echo MyModule::work('hello world.'); abstract class Module { private static $mask = '[[[%s]]]'; public static function work($it) { return preg_replace_callback('~\w+~', array('self', 'self::replace'), $it); } private static function replace($matches) { return sprintf(self::$mask, $matches[0]); } } abstract class MyModule extends Module { protected static $mask = '{{{%s}}}'; private static function replace($matches) { return sprintf(self::$mask, $matches[0]); } }
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/T4ZFX
function name:  (null)
number of ops:  13
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
   5     9        NOP                                                      
  18    10        NOP                                                      
        11        NOP                                                      
  25    12      > RETURN                                                   1

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

End of function work

Function replace:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/T4ZFX
function name:  replace
number of ops:  10
compiled vars:  !0 = $matches
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  13     0  E >   RECV                                             !0      
  14     1        INIT_FCALL                                               'sprintf'
         2        FETCH_CLASS                                 513  :1      
         3        FETCH_R                      static member       $2      'mask'
         4        SEND_VAR                                                 $2
         5        FETCH_DIM_R                                      $3      !0, 0
         6        SEND_VAR                                                 $3
         7        DO_ICALL                                         $4      
         8      > RETURN                                                   $4
  15     9*     > RETURN                                                   null

End of function replace

End of class Module.

Class MyModule:
Function replace:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/T4ZFX
function name:  replace
number of ops:  10
compiled vars:  !0 = $matches
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  22     0  E >   RECV                                             !0      
  23     1        INIT_FCALL                                               'sprintf'
         2        FETCH_CLASS                                 513  :1      
         3        FETCH_R                      static member       $2      'mask'
         4        SEND_VAR                                                 $2
         5        FETCH_DIM_R                                      $3      !0, 0
         6        SEND_VAR                                                 $3
         7        DO_ICALL                                         $4      
         8      > RETURN                                                   $4
  24     9*     > RETURN                                                   null

End of function replace

Function work:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/T4ZFX
function name:  work
number of ops:  8
compiled vars:  !0 = $it
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   9     0  E >   RECV                                             !0      
  10     1        INIT_FCALL                                               'preg_replace_callback'
         2        SEND_VAL                                                 '%7E%5Cw%2B%7E'
         3        SEND_VAL                                                 <array>
         4        SEND_VAR                                                 !0
         5        DO_ICALL                                         $1      
         6      > RETURN                                                   $1
  11     7*     > RETURN                                                   null

End of function work

End of class MyModule.

Generated using Vulcan Logic Dumper, using php 7.1.0