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', 'cSort_0' => 'asc', 'cSort_1' => 'asc', 'search' => 'a']; function _filterArrayByKey(string $filter, $array){ return array_filter( $array, function($k) use ($filter){ return preg_match('/(' . $filter . ')/',$k); }, ARRAY_FILTER_USE_KEY ); } // $v = preg_grep('/[cSearch]\_/', array_keys($vars)); // $cSearch = array_filter($vars, function($k){ return preg_match('/(cSearch)/',$k);}, ARRAY_FILTER_USE_KEY); $cSort = _filterArrayByKey('cSort',$vars); var_dump($cSort); $o = ''; if(!empty($cSort)){ // $cSortStr = } var_dump($o);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/5OGfH
function name:  (null)
number of ops:  17
compiled vars:  !0 = $vars, !1 = $cSort, !2 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   30     1        INIT_FCALL                                               '_filterarraybykey'
          2        SEND_VAL                                                 'cSort'
          3        SEND_VAR                                                 !0
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   31     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                                 
   32     9        ASSIGN                                                   !2, ''
   33    10        ISSET_ISEMPTY_CV                                 ~8      !1
         11        BOOL_NOT                                         ~9      ~8
         12      > JMPZ                                                     ~9, ->13
   37    13    >   INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function _filterarraybykey:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5OGfH
function name:  _filterArrayByKey
number of ops:  11
compiled vars:  !0 = $filter, !1 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        INIT_FCALL                                               'array_filter'
   19     3        SEND_VAR                                                 !1
   20     4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5OGfH%3A20%240'
          5        BIND_LEXICAL                                             ~2, !0
   22     6        SEND_VAL                                                 ~2
   23     7        SEND_VAL                                                 2
          8        DO_ICALL                                         $3      
          9      > RETURN                                                   $3
   25    10*     > RETURN                                                   null

End of function _filterarraybykey

Function %00%7Bclosure%7D%2Fin%2F5OGfH%3A20%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5OGfH
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $k, !1 = $filter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
   21     2        INIT_FCALL                                               'preg_match'
          3        CONCAT                                           ~2      '%2F%28', !1
          4        CONCAT                                           ~3      ~2, '%29%2F'
          5        SEND_VAL                                                 ~3
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8      > RETURN                                                   $4
   22     9*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F5OGfH%3A20%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.32 ms | 1403 KiB | 20 Q