3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $foo = 'old'; public function getFoo() { return $this->foo . "\n"; } } $a = new A; $f = function () { $this->foo = 'new'; }; echo $a->getFoo(); $f->bindTo($a, get_class($a)); $f(); echo $a->getFoo();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/felWl
function name:  (null)
number of ops:  19
compiled vars:  !0 = $a, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    8     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FfelWl%3A8%240'
          4        ASSIGN                                                   !1, ~5
   14     5        INIT_METHOD_CALL                                         !0, 'getFoo'
          6        DO_FCALL                                      0  $7      
          7        ECHO                                                     $7
   15     8        INIT_METHOD_CALL                                         !1, 'bindTo'
          9        SEND_VAR_EX                                              !0
         10        GET_CLASS                                        ~8      !0
         11        SEND_VAL_EX                                              ~8
         12        DO_FCALL                                      0          
   16    13        INIT_DYNAMIC_CALL                                        !1
         14        DO_FCALL                                      0          
   17    15        INIT_METHOD_CALL                                         !0, 'getFoo'
         16        DO_FCALL                                      0  $11     
         17        ECHO                                                     $11
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FfelWl%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/felWl
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_THIS                                       $0      
          1        ASSIGN_OBJ                                               $0, 'foo'
          2        OP_DATA                                                  'new'
   10     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FfelWl%3A8%240

Class A:
Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/felWl
function name:  getFoo
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FETCH_OBJ_R                                      ~0      'foo'
          1        CONCAT                                           ~1      ~0, '%0A'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function getfoo

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.11 ms | 1395 KiB | 13 Q