3v4l.org

run code in 300+ PHP versions simultaneously
<?php $fn = function(){ return $this->getFoo(); }; class Bar{ private $foo = 3; public function getFoo(){ return $this->foo; } } $fn->bindTo(new Bar); echo $fn();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Cmsv
function name:  (null)
number of ops:  11
compiled vars:  !0 = $fn
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F6Cmsv%3A2%240'
          1        ASSIGN                                                   !0, ~1
   14     2        INIT_METHOD_CALL                                         !0, 'bindTo'
          3        NEW                                              $3      'Bar'
          4        DO_FCALL                                      0          
          5        SEND_VAR_NO_REF_EX                                       $3
          6        DO_FCALL                                      0          
   16     7        INIT_DYNAMIC_CALL                                        !0
          8        DO_FCALL                                      0  $6      
          9        ECHO                                                     $6
         10      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F6Cmsv%3A2%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6Cmsv
function name:  {closure}
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_THIS                                       $0      
          1        INIT_METHOD_CALL                                         $0, 'getFoo'
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
    4     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F6Cmsv%3A2%240

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

End of function getfoo

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.74 ms | 1394 KiB | 13 Q