3v4l.org

run code in 300+ PHP versions simultaneously
<?php class T { public $e; public $charset = "UTF-8"; public function output() { $e = $this->e; echo $e('hi'); } } $t = new T; $t->e = function($str) { return $this->charset; }; $t->e->bindTo($t); $t->output();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/igF4A
function name:  (null)
number of ops:  13
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $1      'T'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   13     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FigF4A%3A13%240'
          4        ASSIGN_OBJ                                               !0, 'e'
          5        OP_DATA                                                  ~5
   14     6        FETCH_OBJ_R                                      ~6      !0, 'e'
          7        INIT_METHOD_CALL                                         ~6, 'bindTo'
          8        SEND_VAR_EX                                              !0
          9        DO_FCALL                                      0          
   15    10        INIT_METHOD_CALL                                         !0, 'output'
         11        DO_FCALL                                      0          
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FigF4A%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/igF4A
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        FETCH_THIS                                       $1      
          2        FETCH_OBJ_R                                      ~2      $1, 'charset'
          3      > RETURN                                                   ~2
          4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FigF4A%3A13%240

Class T:
Function output:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/igF4A
function name:  output
number of ops:  7
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   FETCH_OBJ_R                                      ~1      'e'
          1        ASSIGN                                                   !0, ~1
    7     2        INIT_DYNAMIC_CALL                                        !0
          3        SEND_VAL_EX                                              'hi'
          4        DO_FCALL                                      0  $3      
          5        ECHO                                                     $3
    8     6      > RETURN                                                   null

End of function output

End of class T.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
187.75 ms | 1386 KiB | 13 Q