3v4l.org

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

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

End of function %00%7Bclosure%7D%2Fin%2FPsEOD%3A9%240

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

Class x:
Function retval:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PsEOD
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.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.58 ms | 1390 KiB | 13 Q