3v4l.org

run code in 500+ PHP versions simultaneously
<?php $v = Array( 'ccrs_date', Array( 'prelim_title_report_date', Array( 'additional_escrow_deposit_date', Array( 'earnest_money_date', Array( 'acceptance_date', Array( 'contract_date', Array( 'prelim_title_report_date', 'test' ), Array( 'test2' ) ) ) ) ) ) ); $ri = new RecursiveIteratorIterator(new RecursiveArrayIterator($v)); $result = []; $d = null; foreach ($ri as $k => $r) { if ($d !== ($cd = $ri->getDepth())) { $d = $cd; if ($k === 0 && is_scalar($r)) { $result[] = $r; } } } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 27
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 27
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 26
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 24, Position 2 = 26
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 26
Branch analysis from position: 23
Branch analysis from position: 26
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/VEJdN
function name:  (null)
number of ops:  32
compiled vars:  !0 = $v, !1 = $ri, !2 = $result, !3 = $d, !4 = $r, !5 = $k, !6 = $cd
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   33     1        NEW                                                  $8      'RecursiveIteratorIterator'
          2        NEW                                                  $9      'RecursiveArrayIterator'
          3        SEND_VAR_EX                                                  !0
          4        DO_FCALL                                          0          
          5        SEND_VAR_NO_REF_EX                                           $9
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $8
   34     8        ASSIGN                                                       !2, <array>
   35     9        ASSIGN                                                       !3, null
   36    10      > FE_RESET_R                                           $15     !1, ->27
         11    > > FE_FETCH_R                                           ~16     $15, !4, ->27
         12    >   ASSIGN                                                       !5, ~16
   37    13        INIT_METHOD_CALL                                             !1, 'getDepth'
         14        DO_FCALL                                          0  $18     
         15        ASSIGN                                               ~19     !6, $18
         16        IS_NOT_IDENTICAL                                             !3, ~19
         17      > JMPZ                                                         ~20, ->26
   38    18    >   ASSIGN                                                       !3, !6
   39    19        IS_IDENTICAL                                         ~22     !5, 0
         20      > JMPZ_EX                                              ~22     ~22, ->23
         21    >   TYPE_CHECK                                      124  ~23     !4
         22        BOOL                                                 ~22     ~23
         23    > > JMPZ                                                         ~22, ->26
   40    24    >   ASSIGN_DIM                                                   !2
         25        OP_DATA                                                      !4
   36    26    > > JMP                                                          ->11
         27    >   FE_FREE                                                      $15
   45    28        INIT_FCALL                                                   'print_r'
         29        SEND_VAR                                                     !2
         30        DO_ICALL                                                     
         31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
205.42 ms | 2634 KiB | 14 Q