as I said everything costs something!
In this case however a quite a bargain.
See, when you made the UL inline , you are having the rendering agent treat the element as inline text ( so now it has no width) but then you make the LIs inline blocks , which would also collapse if it weren't for the inherited text-align:justify. What I didnt say in my first post, but I did think about... is that most people dont seem to understand how "justification" works, not just in web design, but in typesetting in general.
If you were typesetting a column for a newspaper... the last line w/o enough text to wrap to a follow up column.. will not pad out to justify the spaces between words. In short you need text, that wraps and, spaces between words.
Entirely butting the list items like that ( aside from making the HTML difficult to follow for humans) also makes it appear like "menuitem1menutem2menutem3menutem4" to the rendering agent. even if you were to put a single white space between the LIs the whole issue would be fixed. There is always a trade off, this one seems quite minor.
as far as how to carry it off gracefully in PHP, well I like line breaks and indents when I output my HTML block elements... but if that is prohibited, why not just add a single white space at the end of the string that closes your list item ? echo "</li> "; will literally solve it!