3v4l.org

run code in 300+ PHP versions simultaneously
<?php class FOO { public function bar() { $f = function () { return get_called_class(); }; $f = $f->bindTo(null, __CLASS__); $f = $f->bindTo($this, __CLASS__); var_dump($f); } } $f = new FOO; $f->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mTNuO
function name:  (null)
number of ops:  6
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $1      'FOO'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   14     3        INIT_METHOD_CALL                                         !0, 'bar'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FmTNuO%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mTNuO
function name:  {closure}
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   GET_CALLED_CLASS                                 ~0      
          1      > RETURN                                                   ~0
          2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FmTNuO%3A6%240

Class FOO:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/mTNuO
function name:  bar
number of ops:  17
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FmTNuO%3A6%240'
          1        ASSIGN                                                   !0, ~1
    7     2        INIT_METHOD_CALL                                         !0, 'bindTo'
          3        SEND_VAL_EX                                              null
          4        SEND_VAL_EX                                              'FOO'
          5        DO_FCALL                                      0  $3      
          6        ASSIGN                                                   !0, $3
    8     7        INIT_METHOD_CALL                                         !0, 'bindTo'
          8        FETCH_THIS                                       $5      
          9        SEND_VAR_EX                                              $5
         10        SEND_VAL_EX                                              'FOO'
         11        DO_FCALL                                      0  $6      
         12        ASSIGN                                                   !0, $6
    9    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
   10    16      > RETURN                                                   null

End of function bar

End of class FOO.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.21 ms | 1396 KiB | 15 Q