3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * @author Iltar van der Berg * @version 2.0.0 */ class RecursiveArrayObject extends ArrayObject { /** * overwrites the ArrayObject constructor for * iteration through the "array". When the item * is an array, it creates another self() instead * of an array * * @param Array $array data array */ public function __construct(Array $array) { foreach($array as $key => $value) { if(is_array($value)){ $value = new static($value); } $this->offsetSet($key, $value); } } /** * returns Array when printed (like "echo array();") * instead of an error * * @return string */ public function __ToString() { return 'Array'; } } $array = array('1','2','3'); $array = new RecursiveArrayObject($array); $array->url->uri = 'localhost'; print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6uSaT
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   DECLARE_CLASS                                            'recursivearrayobject', 'arrayobject'
   37     1        ASSIGN                                                   !0, <array>
   38     2        NEW                                              $2      'RecursiveArrayObject'
          3        SEND_VAR_EX                                              !0
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   39     6        FETCH_OBJ_W                                      $5      !0, 'url'
          7        ASSIGN_OBJ                                               $5, 'uri'
          8        OP_DATA                                                  'localhost'
   40     9        INIT_FCALL                                               'print_r'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Class RecursiveArrayObject:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/6uSaT
function name:  __construct
number of ops:  17
compiled vars:  !0 = $array, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   RECV                                             !0      
   18     1      > FE_RESET_R                                       $3      !0, ->15
          2    > > FE_FETCH_R                                       ~4      $3, !1, ->15
          3    >   ASSIGN                                                   !2, ~4
   19     4        TYPE_CHECK                                  128          !1
          5      > JMPZ                                                     ~6, ->10
   20     6    >   NEW                          static              $7      
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
          9        ASSIGN                                                   !1, $7
   22    10    >   INIT_METHOD_CALL                                         'offsetSet'
         11        SEND_VAR_EX                                              !2
         12        SEND_VAR_EX                                              !1
         13        DO_FCALL                                      0          
   18    14      > JMP                                                      ->2
         15    >   FE_FREE                                                  $3
   24    16      > RETURN                                                   null

End of function __construct

Function __tostring:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6uSaT
function name:  __ToString
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E > > RETURN                                                   'Array'
   35     1*       VERIFY_RETURN_TYPE                                       
          2*     > RETURN                                                   null

End of function __tostring

End of class RecursiveArrayObject.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.5 ms | 1400 KiB | 15 Q