After banging my head against a wall, I have FINALLY google the correct terms and found a solution. http://stackoverflow.com/questions/8288414/php-appending-string-to-stdclass-object
So now it looks like this:
$b=1;
while($b<16) {
for($a=1;$a<=8;$a++) {
if(!empty(Input::get('findingA-1-'.$a))) $exam->{'findingA-'.$b} = Input::get('findingA-1-'.$a);
$b++;
if(!empty(Input::get('findingA-1-'.$a))) $exam->{'findingA-'.$b} = Input::get('findingA-2-'.$a);
$b++;
}
}
Just had to add curly braces
$exam->{'findingA-'.$b}
Leaving this for anyone who's had a similar problem
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community