3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Factory { function capitalizer() { return function ($name) { return Factory::capitalize($name); }; } static function capitalize($name) { return strtoupper($name); } } $factory = new Factory(); $capitalizer = $factory->capitalizer(); var_dump($capitalizer('wat'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EMrBg
function name:  (null)
number of ops:  13
compiled vars:  !0 = $factory, !1 = $capitalizer
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $2      'Factory'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   16     3        INIT_METHOD_CALL                                         !0, 'capitalizer'
          4        DO_FCALL                                      0  $5      
          5        ASSIGN                                                   !1, $5
   17     6        INIT_FCALL                                               'var_dump'
          7        INIT_DYNAMIC_CALL                                        !1
          8        SEND_VAL_EX                                              'wat'
          9        DO_FCALL                                      0  $7      
         10        SEND_VAR                                                 $7
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FEMrBg%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EMrBg
function name:  {closure}
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_STATIC_METHOD_CALL                                  'Factory', 'capitalize'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > RETURN                                                   $1
    7     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FEMrBg%3A5%240

Class Factory:
Function capitalizer:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EMrBg
function name:  capitalizer
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FEMrBg%3A5%240'
    7     1      > RETURN                                                   ~0
    8     2*     > RETURN                                                   null

End of function capitalizer

Function capitalize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EMrBg
function name:  capitalize
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_FCALL                                               'strtoupper'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
   12     5*     > RETURN                                                   null

End of function capitalize

End of class Factory.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.67 ms | 1396 KiB | 17 Q