In form alter what is the different way of hiding fields and what is the difference between them? I am currently using the following code to hide the fields in the form

1.  $form['field_name']['#access'] = FALSE;
2.  hide($form['picture']);
3.  unset($form['picture']);
4.  $form['account']['mail']['#disabled'] = TRUE; 


i saw this post https://stackoverflow.com/a/21041471/2251933 , https://drupal.stackexchange.com/a/49985/36808 explains some of the point but not all. 

i want to retain the values in the form after form save but for some reason i want to hide the fields in the form. 

what is the best way to do it and why it is so.
The basic differences are:

$form['field_name']['#access'] = FALSE; hides the form element. When saving the form Drupal will not touch the field. That means the initial value will remain. Maybe interesting: Other users can do with that node's field what ever they want. You saving the node will not undo their changes, although you only know about the old value of that field.

hide($form['picture']); is afaik used in theme functions only. It can cause forms to break because after saving a form this field is expected to have a value but is not even rendered. So use this with care. When you hide a field that is important make sure to manually render it later. Calling hide will also hide all child elements of the element you hide. A use case could be: Render child elements of a form manully and call hide on those elements. When you now render the parent element only those child elements are rendered that did not go through hide.

unset($form['picture']); should not be used. It just drops parts of an array. It is better to use one of the other three functions that keep the data consistent and not delete stuff Drupal expects.

$form['account']['mail']['#disabled'] = TRUE; will not hide the element but just make it unchangable (greyed dropdowns, etc.). It acts like a normal field but the initial value cannot be changed by the user.

In addition to what you asked, Clive added something:

Form elements are commonly converted to array('#type' =&gt; 'value', '#value' =&gt; 'foo') to remove them from the form but keep them server side, and not mess up the submission process. It's the best of all available methods IMO

Hope that help although I am not completely sure about the consequences of unset.

cheers,
j