3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public $username; public $binders; function __construct($username, $binders) { $this->username = $username; $this->binders = $binders; } } class Binder { public $name; public $contents; function __construct($name, $contents = array()) { $this->name = $name; $this->contents = $contents; } } class Card { public $id; public $quantity; function __construct($id, $quantity = 0) { $this->id = $id; $this->quantity = $quantity; } } $users = array ( 'TestName' => new User ( 'TestName', array ( 'BinderName1' => new Binder ( 'BinderName1', array ( 'CardID_1' => new Card('1', '20'), 'CardID_3' => new Card('3', '10'), ) ), 'BinderName2' => new Binder ( 'BinderName2', array ( 'CardID_1' => new Card('1', '7') ) ) ) ) ); print_r($users); $users['TestName']->binders['BinderName1']->contents['CardID_1']->quantity = 5; print_r($users);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p28ma
function name:  (null)
number of ops:  45
compiled vars:  !0 = $users
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   NEW                                              $1      'User'
   41     1        SEND_VAL_EX                                              'TestName'
   43     2        NEW                                              $2      'Binder'
   45     3        SEND_VAL_EX                                              'BinderName1'
   47     4        NEW                                              $3      'Card'
          5        SEND_VAL_EX                                              '1'
          6        SEND_VAL_EX                                              '20'
          7        DO_FCALL                                      0          
          8        INIT_ARRAY                                       ~5      $3, 'CardID_1'
   48     9        NEW                                              $6      'Card'
         10        SEND_VAL_EX                                              '3'
         11        SEND_VAL_EX                                              '10'
         12        DO_FCALL                                      0          
         13        ADD_ARRAY_ELEMENT                                ~5      $6, 'CardID_3'
         14        SEND_VAL_EX                                              ~5
         15        DO_FCALL                                      0          
         16        INIT_ARRAY                                       ~9      $2, 'BinderName1'
   51    17        NEW                                              $10     'Binder'
   53    18        SEND_VAL_EX                                              'BinderName2'
   55    19        NEW                                              $11     'Card'
         20        SEND_VAL_EX                                              '1'
         21        SEND_VAL_EX                                              '7'
         22        DO_FCALL                                      0          
         23        INIT_ARRAY                                       ~13     $11, 'CardID_1'
         24        SEND_VAL_EX                                              ~13
         25        DO_FCALL                                      0          
         26        ADD_ARRAY_ELEMENT                                ~9      $10, 'BinderName2'
         27        SEND_VAL_EX                                              ~9
         28        DO_FCALL                                      0          
         29        INIT_ARRAY                                       ~16     $1, 'TestName'
   37    30        ASSIGN                                                   !0, ~16
   62    31        INIT_FCALL                                               'print_r'
         32        SEND_VAR                                                 !0
         33        DO_ICALL                                                 
   64    34        FETCH_DIM_W                                      $19     !0, 'TestName'
         35        FETCH_OBJ_W                                      $20     $19, 'binders'
         36        FETCH_DIM_W                                      $21     $20, 'BinderName1'
         37        FETCH_OBJ_W                                      $22     $21, 'contents'
         38        FETCH_DIM_W                                      $23     $22, 'CardID_1'
         39        ASSIGN_OBJ                                               $23, 'quantity'
         40        OP_DATA                                                  5
   66    41        INIT_FCALL                                               'print_r'
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                                 
         44      > RETURN                                                   1

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

End of function __construct

End of class User.

Class Binder:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p28ma
function name:  __construct
number of ops:  7
compiled vars:  !0 = $name, !1 = $contents
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      <array>
   20     2        ASSIGN_OBJ                                               'name'
          3        OP_DATA                                                  !0
   21     4        ASSIGN_OBJ                                               'contents'
          5        OP_DATA                                                  !1
   22     6      > RETURN                                                   null

End of function __construct

End of class Binder.

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

End of function __construct

End of class Card.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
205.19 ms | 1392 KiB | 15 Q