3v4l.org

run code in 300+ PHP versions simultaneously
<?php class My_Class { const CLASS_CONSTANT = 'test value'; private $x = array(1,2,3); private function my_function() { $self = $this; $lambda_function = function() use ($self) { echo $self::CLASS_CONSTANT; print_r($self::$x); }; $lambda_function(); } public function start() { $this->my_function(); } } $obj = new My_Class; $obj->start();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kMj1X
function name:  (null)
number of ops:  6
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'My_Class'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_METHOD_CALL                                         !0, 'start'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FkMj1X%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kMj1X
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $self
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   BIND_STATIC                                              !0
   10     1        FETCH_CLASS                                   0  $1      !0
          2        FETCH_CLASS_CONSTANT                             ~2      $1, 'CLASS_CONSTANT'
          3        ECHO                                                     ~2
   11     4        INIT_FCALL                                               'print_r'
          5        FETCH_CLASS                                   0  $3      !0
          6        FETCH_STATIC_PROP_R          unknown             ~4      'x'
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                                 
   12     9      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FkMj1X%3A9%240

Class My_Class:
Function my_function:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kMj1X
function name:  my_function
number of ops:  8
compiled vars:  !0 = $self, !1 = $lambda_function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_THIS                                       ~2      
          1        ASSIGN                                                   !0, ~2
    9     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FkMj1X%3A9%240'
          3        BIND_LEXICAL                                             ~4, !0
          4        ASSIGN                                                   !1, ~4
   14     5        INIT_DYNAMIC_CALL                                        !1
          6        DO_FCALL                                      0          
   15     7      > RETURN                                                   null

End of function my_function

Function start:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kMj1X
function name:  start
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_METHOD_CALL                                         'my_function'
          1        DO_FCALL                                      0          
   19     2      > RETURN                                                   null

End of function start

End of class My_Class.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.79 ms | 1388 KiB | 15 Q