Question: I have two arrays that i want to compare their structure i.e, same keys.
I tried using `array_diff_key` but the problem is that one array is defined like this:

```
    $fields = array('id' , 'site', 'placement', 'device', 'source', 'campaign', 'url', 'country', 'dof_count', 'dof_idx', 'active');

```

so when i use `var_dump()` on it i get this result:

```
{
  [0]=>
  string(2) "id"
  [1]=>
  string(4) "site"
  [2]=>
  string(9) "placement"
  [3]=>
  string(6) "device"
  [4]=>
  string(6) "source"
  [5]=>
  string(8) "campaign"
  [6]=>
  string(3) "url"
  [7]=>
  string(7) "country"
  [8]=>
  string(9) "dof_count"
  [9]=>
  string(7) "dof_idx"
  [10]=>
  string(6) "active"
}

```

and the other is created by a function and comes back like this:

```
{
  ["id"]=>
  NULL
  ["site"]=>
  NULL
  ["placement"]=>
  NULL
  ["device"]=>
  NULL
  ["source"]=>
  NULL
  ["campaign"]=>
  NULL
  ["url"]=>
  NULL
  ["country"]=>
  NULL
  ["dof_count"]=>
  int(0)
  ["dof_idx"]=>
  NULL
  ["active"]=>
  NULL
}

```

so while the two arrays have the same structure, `array_diff_key` won't help. is there a way in php to compare this two array's structure while ignoring the content, which in my case it's all the null's and the one int in the second array?

Answer: 
You can simply use `array_diff` along with `array_keys` as

```
$result = array_diff($fields,array_keys($keys_array));

```

**Note : Not Tested**
Just `array_flip` your `$field` array:

```
var_dump(array_diff_key(array_flip($fields), $array2));

```