3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function __construct ( private readonly string $value ) {} public function getValue() { return $this->value; } } class_alias('A', 'B'); $x = 'O:1:"B":2:{s:8:"' . "\0" . 'A' . "\0" . 'value";s:1:"a";s:8:"' . "\0" . 'B' . "\0" . 'value";s:1:"b";}'; $obj = unserialize($x); var_dump( $obj, $obj->getValue() );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zp82B
function name:  (null)
number of ops:  16
compiled vars:  !0 = $x, !1 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'class_alias'
          1        SEND_VAL                                                 'A'
          2        SEND_VAL                                                 'B'
          3        DO_ICALL                                                 
   13     4        ASSIGN                                                   !0, 'O%3A1%3A%22B%22%3A2%3A%7Bs%3A8%3A%22%00A%00value%22%3Bs%3A1%3A%22a%22%3Bs%3A8%3A%22%00B%00value%22%3Bs%3A1%3A%22b%22%3B%7D'
   14     5        INIT_FCALL                                               'unserialize'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
   15     9        INIT_FCALL                                               'var_dump'
   16    10        SEND_VAR                                                 !1
   17    11        INIT_METHOD_CALL                                         !1, 'getValue'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
   15    14        DO_ICALL                                                 
   18    15      > RETURN                                                   1

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

End of function __construct

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

End of function getvalue

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
128.83 ms | 1013 KiB | 16 Q