CCK field. how to use dynamic names to call CCK fields? (like: $node->$cckname) I have several cck image fields. Each field has a consecutive name, for example:

field_photos_1, 
field_photos_2,
field_photos_3,
field_photos_4
... until 20

So my question is: How to call the image fields in a loop?

for example (pseudocode:)

for($i = 0; $i &gt;= 20; $i++){
$cckname = 'field_photos_'.$i; //$cckname is changing the image field name, then...
echo "&lt;img src='/".$node-&gt;$cckname[0]['filepath']."'";
}


The question in a general way could be: how to use dynamic names to call fields?
You use curly braces {} to delimit the variable inside your reference, as

for($i = 0; $i &gt;= 20; $i++) {
  $cckname = 'field_photos_' . $i; //$cckname is changing the image field name, then...
  echo "&lt;img src='/" . $node-&gt;{$cckname}[0]['filepath'] . "'";
}


This syntax is used in many places in Drupal core, see for example hook_field_prepare_translation.