3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $foo = 'old'; public function getFoo() { return $this->foo . "\n"; } } $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/AH5Me
function name:  (null)
number of ops:  16
compiled vars:  !0 = $f, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FAH5Me%3A7%240'
          1        ASSIGN                                                   !0, ~2
   13     2        INIT_METHOD_CALL                                         !1, 'getFoo'
          3        DO_FCALL                                      0  $4      
          4        ECHO                                                     $4
   14     5        INIT_METHOD_CALL                                         !0, 'bindTo'
          6        SEND_VAR_EX                                              !1
          7        GET_CLASS                                        ~5      !1
          8        SEND_VAL_EX                                              ~5
          9        DO_FCALL                                      0          
   15    10        INIT_DYNAMIC_CALL                                        !0
         11        DO_FCALL                                      0          
   16    12        INIT_METHOD_CALL                                         !1, 'getFoo'
         13        DO_FCALL                                      0  $8      
         14        ECHO                                                     $8
         15      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2FAH5Me%3A7%240

Class A:
Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AH5Me
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.72 ms | 1386 KiB | 13 Q