3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Collection extends ArrayObject { private $data; function __construct() { $this->data = array(); parent::__construct($this->data); } function offsetGet($index) { echo __METHOD__ . "($index)\n"; return parent::offsetGet($index); } function offsetSet($index, $value) { echo __METHOD__ . "(" . (is_null($index) ? "NULL" : $index) . ",$value)\n"; parent::offsetSet($index, $value); } } echo "\n\nInitiate Obj\n"; $arrayObj = new Collection(); echo "Assign values\n"; $arrayObj[] = "foo"; var_dump($arrayObj[0]); $arrayObj[] = "bar"; var_dump($arrayObj[0]); var_dump($arrayObj[1]); $arrayObj["foo"] = "baz"; var_dump($arrayObj["foo"]); print_r($arrayObj); var_dump(count($arrayObj));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gi6SO
function name:  (null)
number of ops:  35
compiled vars:  !0 = $arrayObj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   ECHO                                                     '%0A%0AInitiate+Obj%0A'
   27     1        NEW                                              $1      'Collection'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   29     4        ECHO                                                     'Assign+values%0A'
   31     5        ASSIGN_DIM                                               !0
          6        OP_DATA                                                  'foo'
   32     7        INIT_FCALL                                               'var_dump'
          8        FETCH_DIM_R                                      ~5      !0, 0
          9        SEND_VAL                                                 ~5
         10        DO_ICALL                                                 
   34    11        ASSIGN_DIM                                               !0
         12        OP_DATA                                                  'bar'
   35    13        INIT_FCALL                                               'var_dump'
         14        FETCH_DIM_R                                      ~8      !0, 0
         15        SEND_VAL                                                 ~8
         16        DO_ICALL                                                 
   36    17        INIT_FCALL                                               'var_dump'
         18        FETCH_DIM_R                                      ~10     !0, 1
         19        SEND_VAL                                                 ~10
         20        DO_ICALL                                                 
   38    21        ASSIGN_DIM                                               !0, 'foo'
         22        OP_DATA                                                  'baz'
   39    23        INIT_FCALL                                               'var_dump'
         24        FETCH_DIM_R                                      ~13     !0, 'foo'
         25        SEND_VAL                                                 ~13
         26        DO_ICALL                                                 
   41    27        INIT_FCALL                                               'print_r'
         28        SEND_VAR                                                 !0
         29        DO_ICALL                                                 
   43    30        INIT_FCALL                                               'var_dump'
         31        COUNT                                            ~16     !0
         32        SEND_VAL                                                 ~16
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Class Collection:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gi6SO
function name:  __construct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   ASSIGN_OBJ                                               'data'
          1        OP_DATA                                                  <array>
   10     2        INIT_STATIC_METHOD_CALL                                  
          3        CHECK_FUNC_ARG                                           
          4        FETCH_OBJ_FUNC_ARG                               $1      'data'
          5        SEND_FUNC_ARG                                            $1
          6        DO_FCALL                                      0          
   11     7      > RETURN                                                   null

End of function __construct

Function offsetget:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gi6SO
function name:  offsetGet
number of ops:  11
compiled vars:  !0 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        ROPE_INIT                                     3  ~2      '%28'
          2        ROPE_ADD                                      1  ~2      ~2, !0
          3        ROPE_END                                      2  ~1      ~2, '%29%0A'
          4        CONCAT                                           ~4      'Collection%3A%3AoffsetGet', ~1
          5        ECHO                                                     ~4
   16     6        INIT_STATIC_METHOD_CALL                                  'offsetGet'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0  $5      
          9      > RETURN                                                   $5
   17    10*     > RETURN                                                   null

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Gi6SO
function name:  offsetSet
number of ops:  18
compiled vars:  !0 = $index, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2        TYPE_CHECK                                    2          !0
          3      > JMPZ                                                     ~2, ->6
          4    >   QM_ASSIGN                                        ~3      'NULL'
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~3      !0
          7    >   CONCAT                                           ~4      'Collection%3A%3AoffsetSet%28', ~3
          8        ROPE_INIT                                     3  ~6      '%2C'
          9        ROPE_ADD                                      1  ~6      ~6, !1
         10        ROPE_END                                      2  ~5      ~6, '%29%0A'
         11        CONCAT                                           ~8      ~4, ~5
         12        ECHO                                                     ~8
   22    13        INIT_STATIC_METHOD_CALL                                  'offsetSet'
         14        SEND_VAR_EX                                              !0
         15        SEND_VAR_EX                                              !1
         16        DO_FCALL                                      0          
   23    17      > RETURN                                                   null

End of function offsetset

End of class Collection.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.43 ms | 1400 KiB | 17 Q