Possible Duplicate:
Can PHP detect if its run from a cron job or from the command line?
I'm trying to determine whether or not the STDOUT resource on a PHP command-line script is being piped to another command or not, in order to appropriately display tabular data (if output is direct to terminal, it looks good to have table cells wrapped in +-----+
borders; but not if trying to inspect that data with awk
or another command.)
Afte finding this answer, I've tried inspecting the STDOUT resource with stream_get_meta_data()
and all of the other functions I can find in the PHP manual which operate on streams, but in every case, the resource looks exactly the same whether it is being piped to another process or not.
Is there any way to find this out in PHP?