The description has strange example with double array_pop.
array_pop(array_pop(field_get_items($entity_type, $entity, 'field_a')))
It will generate something like this: Strict warning: Only variables should be passed by reference in eval() (line 3 of ...\modules\computed_field\computed_field.module(399) : eval()'d code).
Here is working example:

$entity_field[0]['value'] =
  field_get_items($entity_type, $entity, 'field_a')[0]['value'] /
  field_get_items($entity_type, $entity, 'field_b')[0]['value'];


core44’s picture

Thanks for this, caught me out for a while!

bkirkendall’s picture

Thanks! You saved me so much agony!

sardbaba’s picture

break9’s picture

Issue summary:View changes

to avoid php notices this should be written as:

  $field_a = field_get_items($entity_type, $entity, 'field_a');
  $field_b = field_get_items($entity_type, $entity, 'field_b');
  $entity_field[0]['value'] = $field_a[0]['value'] / $field_b[0]['value'];
arruk’s picture

how would this be used to total a single field with multiple values?

kiricou’s picture

thanks !!!