PHP checking for array key or using default value
One quick change you can do is making use of ternary operator instead of writing if else block.

$my_variable = array_key_exists('possible_key', $array) 
               ? $array['possible_key'] 
               : 'my default value';