3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { static function blah() { $a = new static(function(){ echo $this->bobo; }); return $a; } public $clos; public $bobo = 22; function __construct(\Closure $c) { $this->clos = $c->bindTo($this, $this); } } $a = Test::blah(); $ss = $a->clos; $ss();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HudDD
function name:  (null)
number of ops:  8
compiled vars:  !0 = $a, !1 = $ss
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_STATIC_METHOD_CALL                                  'Test', 'blah'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   21     3        FETCH_OBJ_R                                      ~4      !0, 'clos'
          4        ASSIGN                                                   !1, ~4
   22     5        INIT_DYNAMIC_CALL                                        !1
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FHudDD%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HudDD
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        FETCH_OBJ_R                                      ~1      $0, 'bobo'
          2        ECHO                                                     ~1
          3      > RETURN                                                   null

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

Class Test:
Function blah:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HudDD
function name:  blah
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   NEW                          static              $1      
          1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FHudDD%3A8%240'
          2        SEND_VAL_EX                                              ~2
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $1
    9     5      > RETURN                                                   !0
   10     6*     > RETURN                                                   null

End of function blah

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HudDD
function name:  __construct
number of ops:  10
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        INIT_METHOD_CALL                                         !0, 'bindTo'
          2        FETCH_THIS                                       $2      
          3        SEND_VAR_EX                                              $2
          4        FETCH_THIS                                       $3      
          5        SEND_VAR_EX                                              $3
          6        DO_FCALL                                      0  $4      
          7        ASSIGN_OBJ                                               'clos'
          8        OP_DATA                                                  $4
   17     9      > RETURN                                                   null

End of function __construct

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.85 ms | 1386 KiB | 13 Q