Documentation

Analyzer
in package

Analyzer is an inspection class for primitive types and classes in PHP

Tags
final

Table of Contents

getType()  : string
Checks the type or class name of a variable
isArray()  : bool
Checks if a variable is an array
isObject()  : bool
Checks if a variable is an object
isScalar()  : bool
Check if a variable is scalar (bool, int, float, string, or null)
typeMatch()  : bool
Checks if two variables are of the same type

Methods

getType()

Checks the type or class name of a variable

public static getType(mixed $param[, bool $returnClassName = true ]) : string
Parameters
$param : mixed

Variable you want to find out the type

$returnClassName : bool = true

Flag to enable/disable inspection of class names

Tags
access

public

Return values
string —

Type or class name of the informed variable

isArray()

Checks if a variable is an array

public static isArray(mixed $param) : bool
Parameters
$param : mixed

Variable you want to find out the type

Tags
access

public

Return values
bool —

The variable is or is not array

isObject()

Checks if a variable is an object

public static isObject(mixed $param) : bool
Parameters
$param : mixed

Variable you want to find out the type

Tags
access

public

Return values
bool —

The variable is or is not object

isScalar()

Check if a variable is scalar (bool, int, float, string, or null)

public static isScalar(mixed $param) : bool
Parameters
$param : mixed

Variable you want to find out the type

Tags
access

public

Return values
bool —

The variable is or is not scalar

typeMatch()

Checks if two variables are of the same type

public static typeMatch(mixed $param1, mixed $param2) : bool
Parameters
$param1 : mixed

Variable 1 you want to compare type

$param2 : mixed

Variable 2 you want to compare type

Tags
access

public

Return values
bool —

The variables are or are not of the same type

Search results