Select List value in an If statement - Computed Field I have created a select list field in my Entity Form.

Select List : none||none and AM||AM and PM||PM


In my computed field, I want to know what did the user chose by using IF STATEMENT

example: 

if($halfday == 'AM')
{
//action
}


I tried to use array_pop (example code :

$halfday = array_pop(field_get_items($entity_type,$entity,'field_halfday'));)

but it does not work for me. What PHP code should I use? Any suggestions?
Write the following code under Computed Code (PHP) texarea in computed filed settings

$calc =  $entity-&gt; field_sample['und'][0]['value'];

if($calc == 'AM')
{
 //action
$entity_field[0]['value'] = 'After Meridian';
}

elseif($calc == 'PM')
{
//action
$entity_field[0]['value'] = 'Prime Meridian';
}


This is a sample tested code which prints the selected item at output of computed field.

Note: replace filed_sample with your select list field machine name.