# recursive function

I havent written functions before and think my problem could be solved with it.

my code so far is in a function but I cant figure out how to write it so i can call the function within he function so i dont have to keep using a for loop.

```function assembly_recursion(\$var1, \$var2){ for(\$i=0; count(\$var1) > \$i; \$i++){ \$martin .= "<tr>"; \$martin .= "<td>\$i</td>"; \$martin .= "<td><b>".\$var1[\$i]['partnum']."</b></td>"; \$martin .= "<td>".\$var1[\$i]['partrev']."</td>"; \$martin .= "<td>".\$var1[\$i]['partdesc']."</td>"; \$martin .= "</tr>"; for(\$ii=0; count(\$var2) > \$ii; \$ii++){ if(\$var1[\$i]['assembly'] == '1' AND \$var1[\$i]['id'] == \$var2[\$ii]['pa_parts_id']){ \$martin .= "<tr>"; \$martin .= "<td>\$i</td>"; \$martin .= "<td>".\$var2[\$ii]['partnum']."</td>"; \$martin .= "<td>".\$var2[\$ii]['partrev']."</td>"; \$martin .= "<td>".\$var2[\$ii]['partdesc']."</td>"; \$martin .= "</tr>"; for(\$iii=0; count(\$var2) > \$iii; \$iii++){ if(\$var2[\$ii]['assembly'] == '1' AND \$var2[\$ii]['id'] == \$var2[\$iii]['pa_parts_id']){ \$martin .= "<tr>"; \$martin .= "<td>\$i</td>"; \$martin .= "<td>".\$var2[\$iii]['partnum']."</td>"; \$martin .= "<td>".\$var2[\$iii]['partrev']."</td>"; \$martin .= "<td>".\$var2[\$iii]['partdesc']."</td>"; \$martin .= "</tr>"; } } } } } return \$martin; }```

What exactly is this code supposed to do? Can you describe what you wish to accomplish?