Quick way to determine if php is running at the command line

Many times it is necessary to determine if the php script is running on the command prompt. Recently I wrote a php shell script which could also be run from a browser and needed to decide in the code if to output a '\n' or a ‘html break’ after a text line.

The following simple function returns a true if the script is run from a command prompt and false otherwise.
(more…)

Read More