3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { private $p = 'secret'; } $o = new x; $f = function(){ return $this->p; }; $g = $f; Closure::bind($f,$o); //echo $f->__invoke(),"\n"; echo $f(),"\n"; echo $g->call($o);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1lhk1
function name:  (null)
number of ops:  19
compiled vars:  !0 = $o, !1 = $f, !2 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   NEW                                              $3      'x'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
    6     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F1lhk1%3A6%240'
          4        ASSIGN                                                   !1, ~6
    7     5        ASSIGN                                                   !2, !1
    8     6        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          7        SEND_VAR                                                 !1
          8        SEND_VAR                                                 !0
          9        DO_FCALL                                      0          
   10    10        INIT_DYNAMIC_CALL                                        !1
         11        DO_FCALL                                      0  $10     
         12        ECHO                                                     $10
         13        ECHO                                                     '%0A'
   11    14        INIT_METHOD_CALL                                         !2, 'call'
         15        SEND_VAR_EX                                              !0
         16        DO_FCALL                                      0  $11     
         17        ECHO                                                     $11
         18      > RETURN                                                   1

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

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

Class x: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.51 ms | 1398 KiB | 13 Q