3v4l.org

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

Function %00%7Bclosure%7D%2Fin%2FMGCgo%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MGCgo
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     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%2FMGCgo%3A17%240

Class T:
Function output:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MGCgo
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

Function setescaper:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MGCgo
function name:  setEscaper
number of ops:  8
compiled vars:  !0 = $close
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
   11     1        INIT_METHOD_CALL                                         !0, 'bindTo'
          2        FETCH_THIS                                       $2      
          3        SEND_VAR_EX                                              $2
          4        DO_FCALL                                      0  $3      
          5        ASSIGN_OBJ                                               'e'
          6        OP_DATA                                                  $3
   12     7      > RETURN                                                   null

End of function setescaper

End of class T.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.7 ms | 1399 KiB | 13 Q