3v4l.org

run code in 300+ PHP versions simultaneously
<?php $ar = Array ( 0 => "[", 1 => " [", 2 => " [", 3 => "Test", 4 => "Server1", 5 => null, 6 => "Server2", 7 => null, 8 => "", 9 => "stopped", 10 => " ]", 11 => " ]", 12 => "]", ); function cleanArray($ar){ $res = []; foreach($ar as $val){ preg_match ('/[\[\]]+/', $val, $matches); if(count($matches) == 0) $res[] = $val; } return $res; } $res = cleanArray($ar); print_r($res);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8F1BI
function name:  (null)
number of ops:  9
compiled vars:  !0 = $ar, !1 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   31     1        INIT_FCALL                                               'cleanarray'
          2        SEND_VAR                                                 !0
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !1, $3
   33     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function cleanarray:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 14
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/8F1BI
function name:  cleanArray
number of ops:  18
compiled vars:  !0 = $ar, !1 = $res, !2 = $val, !3 = $matches
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   RECV                                             !0      
   22     1        ASSIGN                                                   !1, <array>
   23     2      > FE_RESET_R                                       $5      !0, ->15
          3    > > FE_FETCH_R                                               $5, !2, ->15
   24     4    >   INIT_FCALL                                               'preg_match'
          5        SEND_VAL                                                 '%2F%5B%5C%5B%5C%5D%5D%2B%2F'
          6        SEND_VAR                                                 !2
          7        SEND_REF                                                 !3
          8        DO_ICALL                                                 
   25     9        COUNT                                            ~7      !3
         10        IS_EQUAL                                                 ~7, 0
         11      > JMPZ                                                     ~8, ->14
         12    >   ASSIGN_DIM                                               !1
         13        OP_DATA                                                  !2
   23    14    > > JMP                                                      ->3
         15    >   FE_FREE                                                  $5
   27    16      > RETURN                                                   !1
   28    17*     > RETURN                                                   null

End of function cleanarray

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.73 ms | 1018 KiB | 16 Q