Thank you for any help with this.

I'm using <?php print_r($node); ?> to see the following array output.

[field_headline_options] => Array
        (
            [0] => Array
                (
                    [value] => headline-color-black
                    [safe] => headline-color-black
                    [view] => Color: Black
                )
            [1] => Array
                (
                    [value] => headline-size-medium
                    [safe] => headline-size-medium
                    [view] => Size: Medium
                )
        )

I'm trying to access the [value] element of the array using the following:

<?php foreach ($field_headline_options as $value) {
    print
$value; } ?>

I'm only getting the output "Array Array" instead of the desired "headline-color-black headline-size-medium". Can any php guru explain how to access a particular element (in this case 'value') from an array using a foreach command?

Thank you very much,
Scott

Ps. Using D6 with Zen theme.

Comments

You would want to print $value['value']

use

print $value['value'].' ';

to get output "headline-color-black headline-size-medium".

Then try the following:

<?php
foreach ($field_headline_options as $key) {
   foreach (
$key as $value) {
      print
$value.'<br/>';
   }
}
?>

Thank you nevets and suvasish mondal
Scott