I have a script which uses a large amount of IF statements to check the contents of variables and generate HTML. These variables are loaded from a database, and don't change during the session. I'm wondering whether it would be considered bad practice to generate the HTML at the start of the session, then cache say 20Kb or so in a session variable.
It's actually for a dynamic navigation bar. The bar would only need to be generated once, then just echoed from the saved SESSION variable. Would this cause PHP to take a performance hit at all?