Need to ignore empty variable values for Computed Field when multiplying
Both @Neo's answer and @danielesus's question shows PHP code that will throw errors. @Neo, empty() only works with variables before PHP 5.5. Both: array_pop requires a variable or something returned by a reference-returning-function which field_get_items is not.

Now let's consider what field_get_items($entity_type, $entity, 'field_how_many') returns: it returns an array indexed by delta where the values are field_column  =&gt; value. You can do

if ($all_items = field_get_items($entity_type, $entity, 'field_how_many')) {
  $item = reset($all_items);
  $value = reset($item);
}


as there's no need to actually modify the array with array_pop but also you can use your knowledge about Field API and know the actual column name which I suspect will be value here (would be tid for a taxonomy reference field for example) and that $delta is, if you have a field with cardinality 1 is actually 0:

$value = NULL;
if ($all_items = field_get_items($entity_type, $entity, 'field_how_many')) {
  $value = $all_items[0]['value'];
}


Fast and simple.