PHP function reference with examples

Tue May 26 5:57 pm EDT 2026
xtmci@atomicmail.io

Table of Contents

Error handling functions

error_reporting()

The error_reporting() function specifies which PHP errors are reported at runtime:

/* Report all errors. */
error_reporting(E_ALL);

/* Report all errors. It's the same as the previous one. */
error_reporting(-1);

/* Report only fatal errors and warnings. */
error_reporting(E_ERROR | E_WARNING);

/* Turn off all error reporting. */
error_reporting(0);

Variable handling functions

gettype()

The gettype() function returns the type of a given variable:

$var = 5;
$var_type = gettype($var); /* Returns qu_oteintegerqu_ote. */

$var = 3.14;
$var_type = gettype($var); /* Returns qu_otedoublequ_ote. */

$var = 'xtmci';
$var_type = gettype($var); /* Returns qu_otestringqu_ote. */