I have a php script which is run in the terminal and it returns a number the number is human-friendly formated so :
php script.php
will for example output: 1 020 536
But sometimes we need this script to output the number as a computer-friendly version so in my case :
1020536
Is it possible to detect directly from the php script if it's called directly or in the following ways :
echo $(php script.php)
and
php script.php | cat
The both version should output the number non formated.
Is that possible ?
Thanks in advance !
ini_set('memory_limit','1GB');posix_isatty. See my answer for further detail