3v4l.org

run code in 300+ PHP versions simultaneously
<?php $officials = [' off1' , 'off2' , '' , 'off3 ' , null]; // space ^ empty string^ space^ ^null $result = []; array_walk( $officials, function($v) use (&$result) { $v = trim((string) $v); if (strlen($v)) { $result[] = $v; } } ); var_export($result);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/U5fW5
function name:  (null)
number of ops:  12
compiled vars:  !0 = $officials, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    6     1        ASSIGN                                                   !1, <array>
    7     2        INIT_FCALL                                               'array_walk'
    8     3        SEND_REF                                                 !0
    9     4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !1
   14     6        SEND_VAL                                                 ~4
    7     7        DO_ICALL                                                 
   16     8        INIT_FCALL                                               'var_export'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/U5fW5
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $v, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   10     2        INIT_FCALL                                               'trim'
          3        CAST                                          6  ~2      !0
          4        SEND_VAL                                                 ~2
          5        DO_ICALL                                         $3      
          6        ASSIGN                                                   !0, $3
   11     7        STRLEN                                           ~5      !0
          8      > JMPZ                                                     ~5, ->11
   12     9    >   ASSIGN_DIM                                               !1
         10        OP_DATA                                                  !0
   14    11    > > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.62 ms | 1002 KiB | 16 Q