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(),"\n"; $g = function(){ return $this->p; }; $nu = $g->bindto((new x), "x"); echo $nu(),"\n"; echo $g->call((new x));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0ZogT
function name:  (null)
number of ops:  26
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%2F0ZogT%3A9%240'
          1        ASSIGN                                                   !0, ~3
   12     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0  $5      
          4        ECHO                                                     $5
          5        ECHO                                                     '%0A'
   14     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F0ZogT%3A14%241'
          7        ASSIGN                                                   !1, ~6
   15     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
   16    15        INIT_DYNAMIC_CALL                                        !2
         16        DO_FCALL                                      0  $12     
         17        ECHO                                                     $12
         18        ECHO                                                     '%0A'
   18    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
         25      > RETURN                                                   1

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

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

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