3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A extends SplObjectStorage { protected $a = null; public function __construct() { $this->a = '123'; } public function getA() { return $this->a; } } $serialized = serialize(new A()); $obj = unserialize($serialized); $reader = function & ($object, $property) { $value = & \Closure::bind(function & () use ($property) { return $this->$property; }, $object, $object)->__invoke(); return $value; }; $test3 = & $reader($obj, 'a'); echo "Result from Getter\n"; var_dump($obj->getA()); echo "Result from Reflection\n"; var_Dump($test3); echo "This is the deserialized Object\n"; var_Dump($obj);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LCmI2
function name:  (null)
number of ops:  32
compiled vars:  !0 = $serialized, !1 = $obj, !2 = $reader, !3 = $test3
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_FCALL                                               'serialize'
          1        NEW                                              $4      'A'
          2        DO_FCALL                                      0          
          3        SEND_VAR                                                 $4
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !0, $6
   19     6        INIT_FCALL                                               'unserialize'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !1, $8
   21    10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLCmI2%3A21%240'
         11        ASSIGN                                                   !2, ~10
   29    12        INIT_DYNAMIC_CALL                                        !2
         13        SEND_VAR_EX                                              !1
         14        SEND_VAL_EX                                              'a'
         15        DO_FCALL                                      0  $12     
         16        ASSIGN_REF                                               !3, $12
   31    17        ECHO                                                     'Result+from+Getter%0A'
   32    18        INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !1, 'getA'
         20        DO_FCALL                                      0  $14     
         21        SEND_VAR                                                 $14
         22        DO_ICALL                                                 
   34    23        ECHO                                                     'Result+from+Reflection%0A'
   35    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !3
         26        DO_ICALL                                                 
   37    27        ECHO                                                     'This+is+the+deserialized+Object%0A'
   38    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FLCmI2%3A21%240:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/LCmI2
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $object, !1 = $property, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   22     2        INIT_STATIC_METHOD_CALL                                  'Closure', 'bind'
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FLCmI2%3A22%241'
          4        BIND_LEXICAL                                             ~3, !1
   24     5        SEND_VAL                                                 ~3
          6        SEND_VAR                                                 !0
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $4      
          9        INIT_METHOD_CALL                                         $4, '__invoke'
         10        DO_FCALL                                      0  $5      
         11        ASSIGN_REF                                               !2, $5
   26    12      > RETURN_BY_REF                                            !2
   27    13*     > RETURN_BY_REF                                            null

End of function %00%7Bclosure%7D%2Fin%2FLCmI2%3A21%240

Function %00%7Bclosure%7D%2Fin%2FLCmI2%3A22%241:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/LCmI2
function name:  {closure}
number of ops:  5
compiled vars:  !0 = $property
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   BIND_STATIC                                              !0
   23     1        FETCH_THIS                                       $1      
          2        FETCH_OBJ_W                                      $2      $1, !0
          3      > RETURN_BY_REF                                            $2
   24     4*     > RETURN_BY_REF                                            null

End of function %00%7Bclosure%7D%2Fin%2FLCmI2%3A22%241

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LCmI2
function name:  __construct
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                               'a'
          1        OP_DATA                                                  '123'
   10     2      > RETURN                                                   null

End of function __construct

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

End of function geta

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.85 ms | 1400 KiB | 19 Q