3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( array('pear', 'apple'), array('banana', 'coconut'), 'orange' // This is not an array element ); foreach ($array as $value) { // Check type of element... if (is_array($value)) { foreach ($value as $fruit) { echo $fruit . PHP_EOL; } } else { echo $value . PHP_EOL; } } $iterator = new RecursiveArrayIterator($array); foreach(new RecursiveIteratorIterator($iterator) as $value) { echo $value . PHP_EOL; }
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 = 5, Position 2 = 12
Branch analysis from position: 5
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 28
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 15
filename:       /in/W93SC
function name:  (null)
number of ops:  30
compiled vars:  !0 = $array, !1 = $value, !2 = $fruit, !3 = $iterator
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1      > FE_RESET_R                                       $5      !0, ->15
          2    > > FE_FETCH_R                                               $5, !1, ->15
   12     3    >   TYPE_CHECK                                  128          !1
          4      > JMPZ                                                     ~6, ->12
   13     5    > > FE_RESET_R                                       $7      !1, ->10
          6    > > FE_FETCH_R                                               $7, !2, ->10
   14     7    >   CONCAT                                           ~8      !2, '%0A'
          8        ECHO                                                     ~8
   13     9      > JMP                                                      ->6
         10    >   FE_FREE                                                  $7
         11      > JMP                                                      ->14
   17    12    >   CONCAT                                           ~9      !1, '%0A'
         13        ECHO                                                     ~9
   10    14    > > JMP                                                      ->2
         15    >   FE_FREE                                                  $5
   22    16        NEW                                              $10     'RecursiveArrayIterator'
         17        SEND_VAR_EX                                              !0
         18        DO_FCALL                                      0          
         19        ASSIGN                                                   !3, $10
   23    20        NEW                                              $13     'RecursiveIteratorIterator'
         21        SEND_VAR_EX                                              !3
         22        DO_FCALL                                      0          
         23      > FE_RESET_R                                       $15     $13, ->28
         24    > > FE_FETCH_R                                               $15, !1, ->28
   24    25    >   CONCAT                                           ~16     !1, '%0A'
         26        ECHO                                                     ~16
   23    27      > JMP                                                      ->24
         28    >   FE_FREE                                                  $15
   25    29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.59 ms | 1399 KiB | 13 Q