3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'a' => 'a', 'b' => '', 'c' => null, 'd' => 122, 'e' => 0, 'f' => [ 'g' => 'g', 'h' => 0, 'i' => null, 'j' => '' ] ]; $result = array_filter($array, function ($arr) { if (!is_array($arr)) { return strlen($arr) ; } return array_filter($arr) ; } ) ; $r = array_filter($array) ; var_dump($r);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rb7Da
function name:  (null)
number of ops:  15
compiled vars:  !0 = $array, !1 = $result, !2 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'array_filter'
          2        SEND_VAR                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FRb7Da%3A17%240'
   24     4        SEND_VAL                                                 ~4
          5        DO_ICALL                                         $5      
   17     6        ASSIGN                                                   !1, $5
   25     7        INIT_FCALL                                               'array_filter'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !2, $7
   26    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                                 
         14      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FRb7Da%3A17%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rb7Da
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   18     1        TYPE_CHECK                                  128  ~1      !0
          2        BOOL_NOT                                         ~2      ~1
          3      > JMPZ                                                     ~2, ->6
   19     4    >   STRLEN                                           ~3      !0
          5      > RETURN                                                   ~3
   21     6    >   INIT_FCALL                                               'array_filter'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $4      
          9      > RETURN                                                   $4
   24    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FRb7Da%3A17%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.56 ms | 1396 KiB | 17 Q