3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { private $p = 'secret'; function RetVal(){ return $this->p; } } class y { private $q = 'queen'; function RetValue() { return $this->q; } } $f = function() { return (new x)->RetVal(); }; echo $f(),"\n"; $g = function(){ return $this->p; }; $nu = $g->bindto((new x), "x"); echo $nu(),"\n"; echo $g->call((new x)); echo $g->call((new y));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gdt1M
function name:  (null)
number of ops:  32
compiled vars:  !0 = $f, !1 = $g, !2 = $nu
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fgdt1M%3A16%240'
          1        ASSIGN                                                   !0, ~3
   19     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0  $5      
          4        ECHO                                                     $5
          5        ECHO                                                     '%0A'
   21     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fgdt1M%3A21%241'
          7        ASSIGN                                                   !1, ~6
   22     8        INIT_METHOD_CALL                                         !1, 'bindto'
          9        NEW                                              $8      'x'
         10        DO_FCALL                                      0          
         11        SEND_VAR_NO_REF_EX                                       $8
         12        SEND_VAL_EX                                              'x'
         13        DO_FCALL                                      0  $10     
         14        ASSIGN                                                   !2, $10
   23    15        INIT_DYNAMIC_CALL                                        !2
         16        DO_FCALL                                      0  $12     
         17        ECHO                                                     $12
         18        ECHO                                                     '%0A'
   25    19        INIT_METHOD_CALL                                         !1, 'call'
         20        NEW                                              $13     'x'
         21        DO_FCALL                                      0          
         22        SEND_VAR_NO_REF_EX                                       $13
         23        DO_FCALL                                      0  $15     
         24        ECHO                                                     $15
   26    25        INIT_METHOD_CALL                                         !1, 'call'
         26        NEW                                              $16     'y'
         27        DO_FCALL                                      0          
         28        SEND_VAR_NO_REF_EX                                       $16
         29        DO_FCALL                                      0  $18     
         30        ECHO                                                     $18
         31      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fgdt1M%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gdt1M
function name:  {closure}
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $0      'x'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'RetVal'
          3        DO_FCALL                                      0  $2      
          4      > RETURN                                                   $2
   18     5*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fgdt1M%3A16%240

Function %00%7Bclosure%7D%2Fin%2Fgdt1M%3A21%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gdt1M
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     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%2Fgdt1M%3A21%241

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

End of function retval

End of class x.

Class y:
Function retvalue:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gdt1M
function name:  RetValue
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_R                                      ~0      'q'
          1      > RETURN                                                   ~0
   14     2*     > RETURN                                                   null

End of function retvalue

End of class y.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.49 ms | 1399 KiB | 13 Q