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)); $ff = function() use(&$g) { return $g(); }; echo $ff->call((new y));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3qVQ2
function name:  (null)
number of ops:  35
compiled vars:  !0 = $f, !1 = $g, !2 = $nu, !3 = $ff
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F3qVQ2%3A16%240'
          1        ASSIGN                                                   !0, ~4
   19     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0  $6      
          4        ECHO                                                     $6
          5        ECHO                                                     '%0A'
   21     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F3qVQ2%3A21%241'
          7        ASSIGN                                                   !1, ~7
   22     8        INIT_METHOD_CALL                                         !1, 'bindto'
          9        NEW                                              $9      'x'
         10        DO_FCALL                                      0          
         11        SEND_VAR_NO_REF_EX                                       $9
         12        SEND_VAL_EX                                              'x'
         13        DO_FCALL                                      0  $11     
         14        ASSIGN                                                   !2, $11
   23    15        INIT_DYNAMIC_CALL                                        !2
         16        DO_FCALL                                      0  $13     
         17        ECHO                                                     $13
         18        ECHO                                                     '%0A'
   25    19        INIT_METHOD_CALL                                         !1, 'call'
         20        NEW                                              $14     'x'
         21        DO_FCALL                                      0          
         22        SEND_VAR_NO_REF_EX                                       $14
         23        DO_FCALL                                      0  $16     
         24        ECHO                                                     $16
   27    25        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F3qVQ2%3A27%242'
         26        BIND_LEXICAL                                             ~17, !1
         27        ASSIGN                                                   !3, ~17
   30    28        INIT_METHOD_CALL                                         !3, 'call'
         29        NEW                                              $19     'y'
         30        DO_FCALL                                      0          
         31        SEND_VAR_NO_REF_EX                                       $19
         32        DO_FCALL                                      0  $21     
         33        ECHO                                                     $21
         34      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F3qVQ2%3A16%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3qVQ2
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%2F3qVQ2%3A16%240

Function %00%7Bclosure%7D%2Fin%2F3qVQ2%3A21%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3qVQ2
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%2F3qVQ2%3A21%241

Function %00%7Bclosure%7D%2Fin%2F3qVQ2%3A27%242:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3qVQ2
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $g
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   BIND_STATIC                                              !0
   28     1        INIT_DYNAMIC_CALL                                        !0
          2        DO_FCALL                                      0  $1      
          3      > RETURN                                                   $1
   29     4*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F3qVQ2%3A27%242

Class x:
Function retval:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3qVQ2
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/3qVQ2
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:
157.84 ms | 1399 KiB | 13 Q