I am currently writing a formal research report, and I'll be including code with this report.
Question: Is there an accepted way of displaying code in research reports? I'm thinking both in terms of font, spacing, et cetera, and whether the code should be displayed inside the document, or in an appendix.
The code will be JavaScript and PHP. None of the sections of code will be more than 25 lines (so they're mere snippets). There will be approximately half a dozen snippets. Each of the snippets will have a couple of paragraphs explaining what is happening in the code, and a discussion on its pros/cons.
I have no contact with the body to whom the report will be submitted to, and they have no published guidelines on how to format code (please do not question these points).
Well it depends on which style guide your paper is being written to comply to...
Usually code should be written in a monotype font so that it is easily readable (E.g. Lucida Sans Console or Courier New). This means that all letters take up the same space on the page.
When I have written bits for publishing I have indented the code 2.5cm from the side and given it a light grey background, in a Lucida Sans Console font... Following C style code indenting.
I would ask your institution if they have a style guide, but as you have a lack of this ability go with a popular style guide such as the Harvard system and make sure you follow the same format throughout.
Here is a list of journals from Google Scholar which display style: http://scholar.google.com.au/scholar?hl=en&q=PHP+SQL+programming+journal&btnG=Search&as_sdt=2000&as_ylo=&as_vis=0