3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_POST['foo'] = ''; $_POST['bar'] = ''; $_POST['baz'] = ''; // fields $fields = [['Label_Field' => 'foo']]; // just labels $labels = array_column($fields, 'Label_Field'); // filter $_POST by keys which are in $labels $data = array_filter($_POST, fn($k) => in_array($k, $labels), ARRAY_FILTER_USE_KEY); print_r($data);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vna02
function name:  (null)
number of ops:  28
compiled vars:  !0 = $fields, !1 = $labels, !2 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   FETCH_W                      global              $3      '_POST'
          1        ASSIGN_DIM                                               $3, 'foo'
          2        OP_DATA                                                  ''
    4     3        FETCH_W                      global              $5      '_POST'
          4        ASSIGN_DIM                                               $5, 'bar'
          5        OP_DATA                                                  ''
    5     6        FETCH_W                      global              $7      '_POST'
          7        ASSIGN_DIM                                               $7, 'baz'
          8        OP_DATA                                                  ''
    8     9        ASSIGN                                                   !0, <array>
   11    10        INIT_FCALL                                               'array_column'
         11        SEND_VAR                                                 !0
         12        SEND_VAL                                                 'Label_Field'
         13        DO_ICALL                                         $10     
         14        ASSIGN                                                   !1, $10
   14    15        INIT_FCALL                                               'array_filter'
         16        FETCH_R                      global              ~12     '_POST'
         17        SEND_VAL                                                 ~12
         18        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fvna02%3A14%240'
         19        BIND_LEXICAL                                             ~13, !1
         20        SEND_VAL                                                 ~13
         21        SEND_VAL                                                 2
         22        DO_ICALL                                         $14     
         23        ASSIGN                                                   !2, $14
   16    24        INIT_FCALL                                               'print_r'
         25        SEND_VAR                                                 !2
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fvna02%3A14%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/vna02
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $k, !1 = $labels
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        INIT_FCALL                                               'in_array'
          3        SEND_VAR                                                 !0
          4        SEND_VAR                                                 !1
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
          7*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fvna02%3A14%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.69 ms | 1396 KiB | 21 Q