3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $bar = "World"; public function hello() { echo "Hello ", $this->bar, "\n"; } } $foo = new Foo(); $setter = Closure::bind( function($who) { $this->bar = $who; }, $foo, "Foo" ); $foo->hello(); $setter("Bob"); $foo->hello();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mqXoM
function name:  (null)
number of ops:  18
compiled vars:  !0 = $foo, !1 = $setter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $2      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   12     3        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
   13     4        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
   15     5        SEND_VAL                                                 ~5
   16     6        SEND_VAR                                                 !0
   17     7        SEND_VAL                                                 'Foo'
   12     8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !1, $6
   20    10        INIT_METHOD_CALL                                         !0, 'hello'
         11        DO_FCALL                                      0          
   22    12        INIT_DYNAMIC_CALL                                        !1
         13        SEND_VAL_EX                                              'Bob'
         14        DO_FCALL                                      0          
   24    15        INIT_METHOD_CALL                                         !0, 'hello'
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mqXoM
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $who
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        FETCH_THIS                                       $1      
          2        ASSIGN_OBJ                                               $1, 'bar'
          3        OP_DATA                                                  !0
   15     4      > RETURN                                                   null

End of Dynamic Function 0

Class Foo:
Function hello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mqXoM
function name:  hello
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ECHO                                                     'Hello+'
          1        FETCH_OBJ_R                                      ~0      'bar'
          2        ECHO                                                     ~0
          3        ECHO                                                     '%0A'
    7     4      > RETURN                                                   null

End of function hello

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.85 ms | 996 KiB | 13 Q