3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Collection implements IteratorAggregate { public function __construct(array $data) { $this->data = $data; } public function getIterator() { krsort($this->data); return new RecursiveIteratorIterator(new RecursiveArrayIterator($this->data)); } } $c = new Collection([ 10 => ['a', 'b'], 20 => ['c'], ]); var_dump(iterator_to_array($c, false));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fLZgc
function name:  (null)
number of ops:  13
compiled vars:  !0 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_CLASS                                            'collection'
   13     1        NEW                                              $1      'Collection'
   14     2        SEND_VAL_EX                                              <array>
          3        DO_FCALL                                      0          
   13     4        ASSIGN                                                   !0, $1
   18     5        INIT_FCALL                                               'var_dump'
          6        INIT_FCALL                                               'iterator_to_array'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 <false>
          9        DO_ICALL                                         $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

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

End of function __construct

Function getiterator:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fLZgc
function name:  getIterator
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_FCALL                                               'krsort'
          1        FETCH_OBJ_W                                      $0      'data'
          2        SEND_REF                                                 $0
          3        DO_ICALL                                                 
    9     4        NEW                                              $2      'RecursiveIteratorIterator'
          5        NEW                                              $3      'RecursiveArrayIterator'
          6        CHECK_FUNC_ARG                                           
          7        FETCH_OBJ_FUNC_ARG                               $4      'data'
          8        SEND_FUNC_ARG                                            $4
          9        DO_FCALL                                      0          
         10        SEND_VAR_NO_REF_EX                                       $3
         11        DO_FCALL                                      0          
         12      > RETURN                                                   $2
   10    13*     > RETURN                                                   null

End of function getiterator

End of class Collection.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.99 ms | 1396 KiB | 19 Q