is_bool

(PHP 4 , PHP 5)

is_bool --  Détermine si une variable est un booléen

Description

bool is_bool ( mixed var)

is_bool() retourne TRUE si var est un boolean.

Exemple 1. Exemple avec is_bool()

<?php
$a
= false;
$b = 0;

// Comme $a est un booléen, ceci est vrai
if (is_bool($a)) {
    echo
'Oui, c\'est un booléen';
}

// Comme $b n'est pas un booléen, ceci est faux
if (is_bool($b)) {
    echo
'Oui, c\'est un booléen';
}
?>

Voir aussi is_array(), is_float(), is_int(), is_integer(), is_string() et is_object().