I have 4 instances of the same object:
echo $payment->field_course_1_length[0]['value'];
echo $payment->field_course_2_length[0]['value'];
echo $payment->field_course_3_length[0]['value'];
echo $payment->field_course_4_length[0]['value'];
My question is so that I don't have to be typing the same over and over can I put it in a loop like this:
for ($i=1; $i<5; $i++) {
echo $payment->field_course_'$i'_length[0]['value'];
}
Thank you.