I have an array like below. This is coming from a centralised database and I have no way of knowing beforehand what the actual array will contain. I want to compare the sub-arrays on keys and that is why want to delete the keys which are not present is all sub-arrays.
Array (
[0] => Array
(
[a] =>
[b] => 8
[c] => 1
[d] => taille-8
[e] =>
[k] => taill
)
[1] => Array
(
[a] =>
[b] => 7
[c] => 2
[d] => taille-7
[f] =>
[k] => tafefef
)
[2] => Array
(
[a] => ce
[b] => 34
[c] => 2
[d] => taille-34
[g] => dee
[k] => tacefef
) );
I want to delete the keys which are not repeating in all sub-arrays. In the above example they are 'e', 'f' and 'g'. This needs to happen dynamically.
Array (
[0] => Array
(
[a] =>
[b] => 8
[c] => 1
[d] => taille-8
[k] => taill
)
[1] => Array
(
[a] =>
[b] => 7
[c] => 2
[d] => taille-7
[k] => tafefef
)
[2] => Array
(
[a] => ce
[b] => 34
[c] => 2
[d] => taille-34
[k] => tacefef
) );
Any suggestion is appreciated.