3v4l.org

run code in 300+ PHP versions simultaneously
<?php $f = function(){ echo $this->getX(); }; class Test { private $x; public function __construct($x) { $this->x = $x; } public function setX($x){ $this->x = $x; } public function getX(){ return $this->x; } } $t1 = new Test(100); $t2 = new Test(600); $f->call($t1); $closure = $f->bindTo($t2); $closure();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0BedP
function name:  (null)
number of ops:  20
compiled vars:  !0 = $f, !1 = $t1, !2 = $t2, !3 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F0BedP%3A3%240'
          1        ASSIGN                                                   !0, ~4
   15     2        NEW                                              $6      'Test'
          3        SEND_VAL_EX                                              100
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $6
   16     6        NEW                                              $9      'Test'
          7        SEND_VAL_EX                                              600
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !2, $9
   18    10        INIT_METHOD_CALL                                         !0, 'call'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0          
   20    13        INIT_METHOD_CALL                                         !0, 'bindTo'
         14        SEND_VAR_EX                                              !2
         15        DO_FCALL                                      0  $13     
         16        ASSIGN                                                   !3, $13
   21    17        INIT_DYNAMIC_CALL                                        !3
         18        DO_FCALL                                      0          
         19      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F0BedP%3A3%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0BedP
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, 'getX'
          2        DO_FCALL                                      0  $1      
          3        ECHO                                                     $1
          4      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F0BedP%3A3%240

Class Test:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0BedP
function name:  __construct
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'x'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function __construct

Function setx:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0BedP
function name:  setX
number of ops:  4
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'x'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function setx

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

End of function getx

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.77 ms | 1399 KiB | 13 Q