3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $clbk; public function __construct($b = false) { if($b) { $f = new self(); $this->clbk = function() use ($f) { return $f; }; } } } $f = new Foo(true); var_dump($f->clbk());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qC8MP
function name:  (null)
number of ops:  10
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'Foo'
          1        SEND_VAL_EX                                              <true>
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   16     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'clbk'
          6        DO_FCALL                                      0  $4      
          7        SEND_VAR                                                 $4
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FqC8MP%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qC8MP
function name:  {closure}
number of ops:  3
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   BIND_STATIC                                              !0
    9     1      > RETURN                                                   !0
   10     2*     > RETURN                                                   null

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

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 9
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/qC8MP
function name:  __construct
number of ops:  10
compiled vars:  !0 = $b, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      <false>
    6     1      > JMPZ                                                     !0, ->9
    7     2    >   NEW                          self                $2      
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $2
    8     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FqC8MP%3A8%240'
          6        BIND_LEXICAL                                             ~6, !1
          7        ASSIGN_OBJ                                               'clbk'
   10     8        OP_DATA                                                  ~6
   12     9    > > RETURN                                                   null

End of function __construct

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
204.84 ms | 1396 KiB | 15 Q