Is::toggle()

Checks for valid boolean.

Table of Contents
  1. Description
  2. Example
  3. Validation

Description

Is::toggle(mixed $value): bool;

This method checks that the input provided is a literal boolean or a valid boolean string.

Example

if (Is::toggle(false)) {
    // …
}

Validation

Below are examples of input data along with the validation results:

TestResult
'0'true
'1'true
'FALSE'true
'False'true
'NO'true
'No'true
'OFF'true
'ON'true
'Off'true
'On'true
'TRUE'true
'True'true
'YES'true
'Yes'true
'false'true
'no'true
'off'true
'on'true
'true'true
'yes'true
0true
1true
falsetrue
truetrue
' True 'true
'TruE'true
'True asdf'false

Is::file()

Checks if current input is a valid file path.

Is::path()

Checks if current input is a valid path.

Is::toggle()

Checks for valid boolean.

Is::void()

Checks for empty string, array and object.