How many items has a multi-value field? I need to loop through all the values of a multi field as per example bellow:


for ($i = 1; $i &lt; ???; $i++) {   

    $a = $form['field_...']['und'][$i]['#entity']-&gt;field_...['und'][0]['value'];  


}


of course I could do something like this


foreach ($form['field_additional_sections']['und'] as $key=>$value) {
   if (is_int($key)) {
    ....
   }
}


but I was wondering if there is a nicer option to do this. I should probably mention that I'm implementing hook_FORM_ID_form_alter.

Thank you
element_children() is the easiest way to get a list of all child elements in a render array, e.g.

foreach (element_children($form['field_...'][LANGUAGE_NONE]) as $key) {
  $element = $form['field_...'][LANGUAGE_NONE][$key];
}