3v4l.org

run code in 300+ PHP versions simultaneously
<?php $vars = ['len' => '-1', 'start' => '0', 'cNum' => '7', 'cSearch_0' => 'b', 'cSearch_1' => 'c', 'cSearch_2' => 'd', 'cSearch_3' => 'e', 'cSearch_4' => 'f', 'cSearch_5' => 'g', 'cSearch_6' => 'h']; // $v = preg_grep('/[cSearch]\_/', array_keys($vars)); $cSearch = array_filter($vars, function($k){ return preg_match('/(cSearch)/',$k);}, ARRAY_FILTER_USE_KEY); var_dump($cSearch); if(!empty($cSearch)){ $searchColOutStr = ',searchCols: ['; $searchColOut = []; for ($i = 0; $i < $vars['cNum']; $i++){ if(array_key_exists('cSearch_' . $i, $cSearch)){ $searchColOut[] = '{ "search": "' . $cSearch['cSearch_' . $i] . '"}'; }else{ $searchColOut[] = 'null'; } } $searchColOutStr .= implode(',', $searchColOut); $searchColOutStr .= ']'; } var_dump($searchColOutStr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 40
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 18
Branch analysis from position: 34
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 28
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 18
Branch analysis from position: 34
Branch analysis from position: 18
Branch analysis from position: 28
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 18
Branch analysis from position: 34
Branch analysis from position: 18
Branch analysis from position: 40
filename:       /in/UF5In
function name:  (null)
number of ops:  44
compiled vars:  !0 = $vars, !1 = $cSearch, !2 = $searchColOutStr, !3 = $searchColOut, !4 = $i
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%2FUF5In%3A17%240'
          4        SEND_VAL                                                 ~6
          5        SEND_VAL                                                 2
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !1, $7
   18     8        INIT_FCALL                                               'var_dump'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
   20    11        ISSET_ISEMPTY_CV                                 ~10     !1
         12        BOOL_NOT                                         ~11     ~10
         13      > JMPZ                                                     ~11, ->40
   21    14    >   ASSIGN                                                   !2, '%2CsearchCols%3A+%5B'
   22    15        ASSIGN                                                   !3, <array>
   23    16        ASSIGN                                                   !4, 0
         17      > JMP                                                      ->31
   24    18    >   CONCAT                                           ~15     'cSearch_', !4
         19        ARRAY_KEY_EXISTS                                         ~15, !1
         20      > JMPZ                                                     ~16, ->28
   25    21    >   CONCAT                                           ~18     'cSearch_', !4
         22        FETCH_DIM_R                                      ~19     !1, ~18
         23        CONCAT                                           ~20     '%7B+%22search%22%3A+%22', ~19
         24        CONCAT                                           ~21     ~20, '%22%7D'
         25        ASSIGN_DIM                                               !3
         26        OP_DATA                                                  ~21
         27      > JMP                                                      ->30
   27    28    >   ASSIGN_DIM                                               !3
         29        OP_DATA                                                  'null'
   23    30    >   PRE_INC                                                  !4
         31    >   FETCH_DIM_R                                      ~24     !0, 'cNum'
         32        IS_SMALLER                                               !4, ~24
         33      > JMPNZ                                                    ~25, ->18
   30    34    >   INIT_FCALL                                               'implode'
         35        SEND_VAL                                                 '%2C'
         36        SEND_VAR                                                 !3
         37        DO_ICALL                                         $26     
         38        ASSIGN_OP                                     8          !2, $26
   31    39        ASSIGN_OP                                     8          !2, '%5D'
   34    40    >   INIT_FCALL                                               'var_dump'
         41        SEND_VAR                                                 !2
         42        DO_ICALL                                                 
         43      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FUF5In%3A17%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UF5In
function name:  {closure}
number of ops:  7
compiled vars:  !0 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        INIT_FCALL                                               'preg_match'
          2        SEND_VAL                                                 '%2F%28cSearch%29%2F'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $1      
          5      > RETURN                                                   $1
          6*     > RETURN                                                   null

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.09 ms | 1400 KiB | 21 Q