note 105568 modified in features.commandline by danbrown
| From: | danbrown@php.net | Date: | Mon, 29 Aug 2011 12:46:55 +0000 |
| Subject: | note 105568 modified in features.commandline by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-182804@lists.php.net to get a copy of this message | ||
Check directly without calling functions:
<?php
if (PHP_SAPI === 'cli')
{
// ...
}
?>
You can define a constant to use it elsewhere
<?php
define('ISCLI', PHP_SAPI === 'cli');
?>
--was--
Check directly without calling functions:
<?php
if (PHP_SAPI === 'cli')
{
...
}
?>
You can define a constant to use it elsewhere
<?php
define('ISCLI', PHP_SAPI === 'cli');
?>
http://php.net/manual/en/features.commandline.php