3v4l.org

run code in 300+ PHP versions simultaneously
<?php class X { public $hi; public function hi($hi) { $this->hi = $hi; } } class A { protected function foo($name, Closure $t) { $x = new X(); echo $name; echo "\n"; $t($x); print_r($x); } } class B extends A { public function __construct() { $this->foo('users', function($t) { $t->hi('hello!'); }); } } new B();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ocvBb
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   NEW                                              $0      'B'
          1        DO_FCALL                                      0          
          2        FREE                                                     $0
          3      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FocvBb%3A30%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ocvBb
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   RECV                                             !0      
   31     1        INIT_METHOD_CALL                                         !0, 'hi'
          2        SEND_VAL_EX                                              'hello%21'
          3        DO_FCALL                                      0          
   32     4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FocvBb%3A30%240

Class X:
Function hi:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ocvBb
function name:  hi
number of ops:  4
compiled vars:  !0 = $hi
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    8     1        ASSIGN_OBJ                                               'hi'
          2        OP_DATA                                                  !0
    9     3      > RETURN                                                   null

End of function hi

End of class X.

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ocvBb
function name:  foo
number of ops:  14
compiled vars:  !0 = $name, !1 = $t, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        NEW                                              $3      'X'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !2, $3
   18     5        ECHO                                                     !0
   19     6        ECHO                                                     '%0A'
   20     7        INIT_DYNAMIC_CALL                                        !1
          8        SEND_VAR_EX                                              !2
          9        DO_FCALL                                      0          
   22    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   23    13      > RETURN                                                   null

End of function foo

End of class A.

Class B:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ocvBb
function name:  __construct
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   INIT_METHOD_CALL                                         'foo'
          1        SEND_VAL_EX                                              'users'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FocvBb%3A30%240'
   32     3        SEND_VAL_EX                                              ~0
          4        DO_FCALL                                      0          
   33     5      > RETURN                                                   null

End of function __construct

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ocvBb
function name:  foo
number of ops:  14
compiled vars:  !0 = $name, !1 = $t, !2 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        NEW                                              $3      'X'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !2, $3
   18     5        ECHO                                                     !0
   19     6        ECHO                                                     '%0A'
   20     7        INIT_DYNAMIC_CALL                                        !1
          8        SEND_VAR_EX                                              !2
          9        DO_FCALL                                      0          
   22    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !2
         12        DO_ICALL                                                 
   23    13      > RETURN                                                   null

End of function foo

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.06 ms | 1400 KiB | 15 Q