3v4l.org

run code in 300+ PHP versions simultaneously
<?php function hasNonEmptyArray(array $array): bool { try { array_walk_recursive( $array, fn($v, $k) => throw new Exception("Found element $k\n") ); return false; } catch (Exception $e) { echo $e->getMessage(); return true; } } $array = [ [ 'one' => [], 'two' => [ 'a' => [ 'foo' => [], ], 'b' => [] ], 'three' => [ 'c' => [ 'fizz' => 'buzz' ] ] ] ]; var_export(hasNonEmptyArray($array));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EXIE3
function name:  (null)
number of ops:  8
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ASSIGN                                                   !0, <array>
   34     1        INIT_FCALL                                               'var_export'
          2        INIT_FCALL                                               'hasnonemptyarray'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Function hasnonemptyarray:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EXIE3
function name:  hasNonEmptyArray
number of ops:  15
compiled vars:  !0 = $array, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'array_walk_recursive'
    7     2        SEND_REF                                                 !0
    8     3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
    9     4        SEND_VAL                                                 ~2
    6     5        DO_ICALL                                                 
   10     6      > RETURN                                                   <false>
          7*       JMP                                                      ->13
   11     8  E > > CATCH                                       last         'Exception'
   12     9    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         10        DO_FCALL                                      0  $4      
         11        ECHO                                                     $4
   13    12      > RETURN                                                   <true>
   15    13*       VERIFY_RETURN_TYPE                                       
         14*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/EXIE3
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $v, !1 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        NEW                                              $2      'Exception'
          3        ROPE_INIT                                     3  ~4      'Found+element+'
          4        ROPE_ADD                                      1  ~4      ~4, !1
          5        ROPE_END                                      2  ~3      ~4, '%0A'
          6        SEND_VAL_EX                                              ~3
          7        DO_FCALL                                      0          
          8      > THROW                                         1          $2
          9*       RETURN                                                   <true>
    9    10*     > RETURN                                                   null

End of Dynamic Function 0

End of function hasnonemptyarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.25 ms | 1006 KiB | 16 Q