3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Entry implements \Serializable { protected $id; protected $role; public function __construct($id, $role) { $this->id = $id; $this->role = $role; } public function serialize() { return serialize([$this->id, $this->role]); } } class FieldEntry extends Entry implements \Serializable { protected $field; public function __construct($id, $role, $field) { parent::__construct($id, $role); $this->field = $field; } public function serialize() { return serialize([$this->field, parent::serialize()]); } } class Role { protected $name; public function __construct($name) { $this->name = $name; } } $b = new Role('test'); $a = new FieldEntry(1, $b, 'name'); $a1 = new FieldEntry(2, $b, 'age'); $s = serialize( array( // Acl:serialize (line 260) [ // classFieldAces 'fieldOne' => [$a], 'fieldTwo' => [$a1], ] ) ); var_dump($s); $uns = unserialize($s); var_dump($uns[0]['fieldOne'][0], $uns[0]['fieldTwo'][0]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZORdG
function name:  (null)
number of ops:  45
compiled vars:  !0 = $b, !1 = $a, !2 = $a1, !3 = $s, !4 = $uns
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   DECLARE_CLASS                                            'entry'
   20     1        DECLARE_CLASS                                            'fieldentry', 'entry'
   44     2        NEW                                              $5      'Role'
          3        SEND_VAL_EX                                              'test'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $5
   46     6        NEW                                              $8      'FieldEntry'
          7        SEND_VAL_EX                                              1
          8        SEND_VAR_EX                                              !0
          9        SEND_VAL_EX                                              'name'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $8
   47    12        NEW                                              $11     'FieldEntry'
         13        SEND_VAL_EX                                              2
         14        SEND_VAR_EX                                              !0
         15        SEND_VAL_EX                                              'age'
         16        DO_FCALL                                      0          
         17        ASSIGN                                                   !2, $11
   49    18        INIT_FCALL                                               'serialize'
   52    19        INIT_ARRAY                                       ~14     !1
         20        INIT_ARRAY                                       ~15     ~14, 'fieldOne'
   53    21        INIT_ARRAY                                       ~16     !2
         22        ADD_ARRAY_ELEMENT                                ~15     ~16, 'fieldTwo'
         23        INIT_ARRAY                                       ~17     ~15
         24        SEND_VAL                                                 ~17
         25        DO_ICALL                                         $18     
   49    26        ASSIGN                                                   !3, $18
   57    27        INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !3
         29        DO_ICALL                                                 
   59    30        INIT_FCALL                                               'unserialize'
         31        SEND_VAR                                                 !3
         32        DO_ICALL                                         $21     
         33        ASSIGN                                                   !4, $21
   62    34        INIT_FCALL                                               'var_dump'
         35        FETCH_DIM_R                                      ~23     !4, 0
         36        FETCH_DIM_R                                      ~24     ~23, 'fieldOne'
         37        FETCH_DIM_R                                      ~25     ~24, 0
         38        SEND_VAL                                                 ~25
         39        FETCH_DIM_R                                      ~26     !4, 0
         40        FETCH_DIM_R                                      ~27     ~26, 'fieldTwo'
         41        FETCH_DIM_R                                      ~28     ~27, 0
         42        SEND_VAL                                                 ~28
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

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

End of function __construct

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZORdG
function name:  serialize
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   INIT_FCALL                                               'serialize'
          1        FETCH_OBJ_R                                      ~0      'id'
          2        INIT_ARRAY                                       ~1      ~0
          3        FETCH_OBJ_R                                      ~2      'role'
          4        ADD_ARRAY_ELEMENT                                ~1      ~2
          5        SEND_VAL                                                 ~1
          6        DO_ICALL                                         $3      
          7      > RETURN                                                   $3
   17     8*     > RETURN                                                   null

End of function serialize

End of class Entry.

Class FieldEntry:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZORdG
function name:  __construct
number of ops:  10
compiled vars:  !0 = $id, !1 = $role, !2 = $field
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   25     3        INIT_STATIC_METHOD_CALL                                  
          4        SEND_VAR_EX                                              !0
          5        SEND_VAR_EX                                              !1
          6        DO_FCALL                                      0          
   26     7        ASSIGN_OBJ                                               'field'
          8        OP_DATA                                                  !2
   27     9      > RETURN                                                   null

End of function __construct

Function serialize:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZORdG
function name:  serialize
number of ops:  10
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   INIT_FCALL                                               'serialize'
          1        FETCH_OBJ_R                                      ~0      'field'
          2        INIT_ARRAY                                       ~1      ~0
          3        INIT_STATIC_METHOD_CALL                                  'serialize'
          4        DO_FCALL                                      0  $2      
          5        ADD_ARRAY_ELEMENT                                ~1      $2
          6        SEND_VAL                                                 ~1
          7        DO_ICALL                                         $3      
          8      > RETURN                                                   $3
   32     9*     > RETURN                                                   null

End of function serialize

End of class FieldEntry.

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

End of function __construct

End of class Role.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.75 ms | 1404 KiB | 19 Q