Oihana PHP Commands

clearConsole.php

Table of Contents

Functions

clearConsole()  : false|string
Clears the terminal console screen, depending on the operating system.

Functions

clearConsole()

Clears the terminal console screen, depending on the operating system.

clearConsole([bool $clearable = true ]) : false|string

On Windows systems, it runs cls; on Unix-based systems (Linux/macOS), it runs clear. If $clearable is set to false, the function does nothing and returns false.

Note: The command relies on the system's availability of cls or clear. Use with caution in restricted or sandboxed environments.

Parameters
$clearable : bool = true

Whether or not to perform the console clear.

Tags
example
clearConsole(); // Clears the screen
clearConsole(false); // Does nothing
author

Marc Alcaraz (ekameleon)

since
1.0.0
Return values
false|string

Returns the last line from the shell output, or false on failure or if $clearable is false.


        
On this page

Search results