3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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)); $g = function(){ return $this->q; }; echo $g->call((new y));
based on gdt1M
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/gVPet
function name:  (null)
number of ops:  36
compiled vars:  !0 = $f, !1 = $g, !2 = $nu
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
   9     1        NOP                                                      
  16     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FgVPet0x7fb0dc48e0fd'
  18     3        ASSIGN                                                   !0, ~5
  19     4        INIT_DYNAMIC_CALL                                        !0
         5        DO_FCALL                                      0  $7      
         6        ECHO                                                     $7
         7        ECHO                                                     '%0A'
  21     8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FgVPet0x7fb0dc48e133'
         9        ASSIGN                                                   !1, ~8
  22    10        INIT_METHOD_CALL                                         !1, 'bindto'
        11        NEW                                              $10     :-1
        12        DO_FCALL                                      0          
        13        SEND_VAR_NO_REF                               0          $10
        14        SEND_VAL_EX                                              'x'
        15        DO_FCALL                                      0  $12     
        16        ASSIGN                                                   !2, $12
  23    17        INIT_DYNAMIC_CALL                                        !2
        18        DO_FCALL                                      0  $14     
        19        ECHO                                                     $14
        20        ECHO                                                     '%0A'
  25    21        INIT_METHOD_CALL                                         !1, 'call'
        22        NEW                                              $15     :5
        23        DO_FCALL                                      0          
        24        SEND_VAR_NO_REF                               0          $15
        25        DO_FCALL                                      0  $17     
        26        ECHO                                                     $17
  26    27        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FgVPet0x7fb0dc48e1a2'
        28        ASSIGN                                                   !1, ~18
  27    29        INIT_METHOD_CALL                                         !1, 'call'
        30        NEW                                              $20     :10
        31        DO_FCALL                                      0          
        32        SEND_VAR_NO_REF                               0          $20
        33        DO_FCALL                                      0  $22     
        34        ECHO                                                     $22
        35      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FgVPet0x7fb0dc48e0fd:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/gVPet
function name:  {closure}
number of ops:  6
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  17     0  E >   NEW                                              $0      :-6
         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%2FgVPet0x7fb0dc48e0fd

Function %00%7Bclosure%7D%2Fin%2FgVPet0x7fb0dc48e133:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/gVPet
function name:  {closure}
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  21     0  E >   FETCH_OBJ_R                                      $0      'p'
         1      > RETURN                                                   $0
         2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FgVPet0x7fb0dc48e133

Function %00%7Bclosure%7D%2Fin%2FgVPet0x7fb0dc48e1a2:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/gVPet
function name:  {closure}
number of ops:  3
compiled vars:  none
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
  26     0  E >   FETCH_OBJ_R                                      $0      'q'
         1      > RETURN                                                   $0
         2*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FgVPet0x7fb0dc48e1a2

Class x:
Function retval:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/gVPet
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
Jump found. Position 1 = -2
filename:       /in/gVPet
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 7.1.0