If you don't buffer your output, it doesn't seem like it would be possible for a web server to output a Content-Length header. For static files it can check the filesize, but for dynamic files that send output a little by little there is no way to know how many bytes it is going to output. And the headers have to be sent before a single byte is output.
Also if you're wondering why the Content-Length is important, the browser doesn't close the connection as long as the script is running. So if you register time consuming shutdown functions, the browser will still 'spin' waiting for more content until they complete. (I'm not sure this happens under all conditions, but I am certain the sending the Content-Length always prevents this.)
You might take note that this manual page does not currently output any Content-Length header.
Alternatively using mb_strlen($output, 'latin1') seems to work to determine bytes in a string. strlen may or may not depending on if it has been set up as a multibyte or not.