The foreach construct provides an easy way to iterate over arrays. foreach works only on arrays and objects, and will issue an error when you try to use it on a variable with a different data type or an uninitialized variable. There are two syntaxes:

foreach (array_expression as $value)
statement
foreach (array_expression as $key => $value)
statement

[php]
<?php
$array_values = get_post_meta($post->ID, ‘ecpt_custom_feild_name’, true);
$count = 0;
foreach($array_values as $value){
$count++;
echo $array_values.'<br />’;
} ?>
[/php]

The first form loops over the array given by array_expression. On each iteration, the value of the current element is assigned to $value and the internal array pointer is advanced by one (so on the next iteration, you’ll be looking at the next element).