Indexing the name value in AR

Hi all,

I have 20 columns in my table: (column_1, column_2, column_3, …column_20).

How can I make a loop to treat this values. I’ve tried this:




<?php for ($i = 1; $i <= 20; $i++) { ?>

<?php echo "$model->column_".$i;?>

<?php } ?>



But, of course, this dosn’t work ! I’ve tried a lot of things, but not working.

Can anyone help me please?

Finally, I found the solution for those whose interesting:


<?php echo $model->__get("column_".$i);?>

Thanks for all

or


echo $model->{'column_' . $i};

:)