3v4l.org

run code in 300+ PHP versions simultaneously
l<?php function callStatic($class, $method, $args, $ref, $defined, $called) { var_dump($class, $defined, $called); $ref = new \ReflectionMethod($class, $method); $ref->setAccessible(true); return $ref->invokeArgs(null, array($args)); } class n_0d19ad5d1a89cbbf06a49f56e9dcb11d { public static function foo() { var_dump(get_called_class()); $a = function () { set_error_handler(function () { }); $called = get_called_class(); restore_error_handler(); return $called; }; var_dump($a()); return callStatic('static', 'bar', array(), array(), __CLASS__, call_user_func(function () { set_error_handler(function () { }); $called = get_called_class(); restore_error_handler(); return $called; })); } } class n_1c54f3f5b4e9e0fc521faa21fe127ad8 extends n_0d19ad5d1a89cbbf06a49f56e9dcb11d { protected static function bar() { return __CLASS__; } } echo callStatic('n_1c54f3f5b4e9e0fc521faa21fe127ad8', 'foo', array(), array(), __CLASS__, call_user_func(function () { set_error_handler(function () { }); $called = get_called_class(); restore_error_handler(); return $called; }));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     'l'
   41     1        INIT_FCALL                                               'callstatic'
          2        SEND_VAL                                                 'n_1c54f3f5b4e9e0fc521faa21fe127ad8'
          3        SEND_VAL                                                 'foo'
          4        SEND_VAL                                                 <array>
          5        SEND_VAL                                                 <array>
          6        SEND_VAL                                                 ''
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FR5bY5%3A41%244'
   48     8        INIT_USER_CALL                                0          'call_user_func', ~0
          9        DO_FCALL                                      0  $1      
         10        SEND_VAR                                                 $1
         11        DO_FCALL                                      0  $2      
         12        ECHO                                                     $2
         13      > RETURN                                                   1

Function callstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  callStatic
number of ops:  26
compiled vars:  !0 = $class, !1 = $method, !2 = $args, !3 = $ref, !4 = $defined, !5 = $called
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
          4        RECV                                             !4      
          5        RECV                                             !5      
    4     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        SEND_VAR                                                 !4
          9        SEND_VAR                                                 !5
         10        DO_ICALL                                                 
    5    11        NEW                                              $7      'ReflectionMethod'
         12        SEND_VAR_EX                                              !0
         13        SEND_VAR_EX                                              !1
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !3, $7
    6    16        INIT_METHOD_CALL                                         !3, 'setAccessible'
         17        SEND_VAL_EX                                              <true>
         18        DO_FCALL                                      0          
    7    19        INIT_METHOD_CALL                                         !3, 'invokeArgs'
         20        SEND_VAL_EX                                              null
         21        INIT_ARRAY                                       ~11     !2
         22        SEND_VAL_EX                                              ~11
         23        DO_FCALL                                      0  $12     
         24      > RETURN                                                   $12
    8    25*     > RETURN                                                   null

End of function callstatic

Function %00%7Bclosure%7D%2Fin%2FR5bY5%3A15%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $called
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'set_error_handler'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FR5bY5%3A16%241'
   18     2        SEND_VAL                                                 ~1
          3        DO_ICALL                                                 
   19     4        GET_CALLED_CLASS                                 ~3      
          5        ASSIGN                                                   !0, ~3
   20     6        INIT_FCALL                                               'restore_error_handler'
          7        DO_ICALL                                                 
   21     8      > RETURN                                                   !0
   22     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FR5bY5%3A15%240

Function %00%7Bclosure%7D%2Fin%2FR5bY5%3A16%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FR5bY5%3A16%241

Function %00%7Bclosure%7D%2Fin%2FR5bY5%3A24%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $called
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   INIT_FCALL                                               'set_error_handler'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FR5bY5%3A25%243'
   27     2        SEND_VAL                                                 ~1
          3        DO_ICALL                                                 
   28     4        GET_CALLED_CLASS                                 ~3      
          5        ASSIGN                                                   !0, ~3
   29     6        INIT_FCALL                                               'restore_error_handler'
          7        DO_ICALL                                                 
   30     8      > RETURN                                                   !0
   31     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FR5bY5%3A24%242

Function %00%7Bclosure%7D%2Fin%2FR5bY5%3A25%243:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FR5bY5%3A25%243

Function %00%7Bclosure%7D%2Fin%2FR5bY5%3A41%244:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $called
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   INIT_FCALL                                               'set_error_handler'
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FR5bY5%3A42%245'
   44     2        SEND_VAL                                                 ~1
          3        DO_ICALL                                                 
   45     4        GET_CALLED_CLASS                                 ~3      
          5        ASSIGN                                                   !0, ~3
   46     6        INIT_FCALL                                               'restore_error_handler'
          7        DO_ICALL                                                 
   47     8      > RETURN                                                   !0
   48     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FR5bY5%3A41%244

Function %00%7Bclosure%7D%2Fin%2FR5bY5%3A42%245:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   44     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FR5bY5%3A42%245

Class n_0d19ad5d1a89cbbf06a49f56e9dcb11d:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  foo
number of ops:  24
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CALLED_CLASS                                 ~1      
          2        SEND_VAL                                                 ~1
          3        DO_ICALL                                                 
   15     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FR5bY5%3A15%240'
          5        ASSIGN                                                   !0, ~3
   23     6        INIT_FCALL                                               'var_dump'
          7        INIT_DYNAMIC_CALL                                        !0
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                                 
   24    11        INIT_FCALL                                               'callstatic'
         12        SEND_VAL                                                 'static'
         13        SEND_VAL                                                 'bar'
         14        SEND_VAL                                                 <array>
         15        SEND_VAL                                                 <array>
         16        SEND_VAL                                                 'n_0d19ad5d1a89cbbf06a49f56e9dcb11d'
         17        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FR5bY5%3A24%242'
   31    18        INIT_USER_CALL                                0          'call_user_func', ~7
         19        DO_FCALL                                      0  $8      
         20        SEND_VAR                                                 $8
         21        DO_FCALL                                      0  $9      
         22      > RETURN                                                   $9
   32    23*     > RETURN                                                   null

End of function foo

End of class n_0d19ad5d1a89cbbf06a49f56e9dcb11d.

Class n_1c54f3f5b4e9e0fc521faa21fe127ad8:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  bar
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   38     0  E > > RETURN                                                   'n_1c54f3f5b4e9e0fc521faa21fe127ad8'
   39     1*     > RETURN                                                   null

End of function bar

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/R5bY5
function name:  foo
number of ops:  24
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'var_dump'
          1        GET_CALLED_CLASS                                 ~1      
          2        SEND_VAL                                                 ~1
          3        DO_ICALL                                                 
   15     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FR5bY5%3A15%240'
          5        ASSIGN                                                   !0, ~3
   23     6        INIT_FCALL                                               'var_dump'
          7        INIT_DYNAMIC_CALL                                        !0
          8        DO_FCALL                                      0  $5      
          9        SEND_VAR                                                 $5
         10        DO_ICALL                                                 
   24    11        INIT_FCALL                                               'callstatic'
         12        SEND_VAL                                                 'static'
         13        SEND_VAL                                                 'bar'
         14        SEND_VAL                                                 <array>
         15        SEND_VAL                                                 <array>
         16        SEND_VAL                                                 'n_0d19ad5d1a89cbbf06a49f56e9dcb11d'
         17        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FR5bY5%3A24%242'
   31    18        INIT_USER_CALL                                0          'call_user_func', ~7
         19        DO_FCALL                                      0  $8      
         20        SEND_VAR                                                 $8
         21        DO_FCALL                                      0  $9      
         22      > RETURN                                                   $9
   32    23*     > RETURN                                                   null

End of function foo

End of class n_1c54f3f5b4e9e0fc521faa21fe127ad8.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.48 ms | 1410 KiB | 22 Q