fname = $filename; echo "appending $filename
"; $list[] = $d; } foreach($list as $l) { $f = $l->fname; echo "list item : $f
"; } ?> output on php 5: appending . appending .. appending file_a appending file_b appending file_c list item : file_c list item : file_c list item : file_c list item : file_c list item : file_c