Memory on the server side will be largely unrelated to the number of DOM elements produced, as you will probably just be echoing those as strings. Obviously, the number of DOM elements will have a correlation to the size of the HTML (in bytes), and this may end up contributing to the amount of memory used. (This part is pretty easy to measure: save the resulting HTML as a file, and ask your OS how much space it takes up on disk.)
The largest portion of memory usage, though, will probably be the actual data (arrays, objects, intermediate variables) used to generate that HTML. For instance, if you are retrieving data from a database, the more rows you are dealing with, the more memory that resultset will take up; as it is transformed between different representations, it will likely be in memory multiple times.
It's worth noting that PHP 5.4 includes some pretty major improvements to memory usage, so if you're running an earlier version, it might be worth looking at the possibility of upgrading.