Oihana PHP

isCliWithFile.php

Table of Contents

Functions

isCliWithFile()  : bool
Checks if the PHP script is running in CLI mode **and** was launched with an actual file.

Functions

isCliWithFile()

Checks if the PHP script is running in CLI mode **and** was launched with an actual file.

isCliWithFile() : bool

Returns true if PHP is executed from the command line and $_SERVER['argv'][0] points to an existing file.

Tags
example
use function oihana\core\env\isCliWithFile;

if (isCliWithFile())
{
    echo "CLI mode with script file\n";
}
else
{
    echo "Not a CLI script with a file\n";
}
author

Marc Alcaraz

since
1.0.0
Return values
bool

true if running in CLI with a real script file, false otherwise


        
On this page

Search results