LeamHall/LHTraveller_Mercenary_Generator — pull request #1 by tml (2013-01-01 02:29:45+00:00)
Title: Advice on general direction

1) You've "over-generalized" your code to the point it will be frustrating to maintain. Make the page control its own layout, instead of moving that into a function library;
2) Iterate over $_POST values based on the keys in $troop_count and $stats, over-riding their values as you find new things in $_POST - this makes your code quite a bit clearer on what this block is trying to do;
3) Use the "complex string syntax" in your heredoc (http://us1.php.net/manual/en/language.types.string.php#language.types.string.parsing.complex)

Note that I'm also suggesting you not expose most of the details of generate_company() out to this level of your script. There's no reason for it, and it makes the code more brittle than it needs to be.