3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4S7ts
function name:  (null)
number of ops:  14
compiled vars:  !0 = $c
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   DECLARE_CLASS                                    $1      'collection'
         1        ADD_INTERFACE                                            $1, 'IteratorAggregate'
         2        VERIFY_ABSTRACT_CLASS                                    $1
  13     3        NEW                                              $2      :-1
  14     4        SEND_VAL_EX                                              <array>
         5        DO_FCALL                                      0          
         6        ASSIGN                                                   !0, $2
  18     7        INIT_FCALL                                               'var_dump'
         8        INIT_FCALL                                               'iterator_to_array'
         9        SEND_VAR                                                 !0
        10        DO_FCALL_BY_NAME                                         
        11        SEND_VAR                                                 $5
        12        DO_ICALL                                                 
        13      > RETURN                                                   1

Class Collection:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4S7ts
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/4S7ts
function name:  getIterator
number of ops:  13
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      :-3
         5        NEW                                              $3      :-1
         6        FETCH_OBJ_FUNC_ARG                               $4      'data'
         7        SEND_VAR_EX                                              $4
         8        DO_FCALL                                      0          
         9        SEND_VAR_NO_REF_EX                                       $3
        10        DO_FCALL                                      0          
        11      > RETURN                                                   $2
  10    12*     > RETURN                                                   null

End of function getiterator

End of class Collection.

Generated using Vulcan Logic Dumper, using php 7.3.0