Check that variable is array before imploding.