How to suppress a key from a multidimensional array and get the next occurrence key.
$array_example = array(
'default_group' => 'styling',
'general' => esc_html__('General', THEMETEXTDOMAIN),
// User can enter it here
// 'default_group' => 'styling',
'styling' => esc_html__('Styling', THEMETEXTDOMAIN),
// 'default_group' => 'styling',
'animate' => esc_html__('Animate', THEMETEXTDOMAIN),
)
[default_group] key is a fixed key but it might be at any position.
I need to get the next key if the [default_group] key not exist or it has an empty value.
if( array_key_exists( 'default_group', $array_example ) && !empty( $array_example['default_group'] ) ) {
$col_group_default = sanitize_text_field( $array_example['default_group'] );
} else {
// Here I want to get the key BUT NOT [default_group]
}