Vous êtes ici Fonction PHP > Description de la fonction is_bool()

 

Recherche sur les Noms des fonctions php/mysql

 
 

is_bool()

Définition

- (PHP 4, PHP 5)

Description

bool is_bool ( mixed $var )

is_bool() détermine si la variable donnée est un booléen.

Liste de paramètres

var

La variable à évaluer.

Valeurs de retour

Retourne TRUE si var est un booléen, FALSE sinon.

Exemples

Exemple #1 Exemple avec is_bool()

<?php
$a 
false;
$b 0;

// Si $a est un booléen, ceci sera vrai
if (is_bool($a)) {
    echo 
"Oui, c'est un booléen.";
}

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



 
 

Bouts de code utilisant la fonction is_bool()



<?php /* ... */  {/* for future use */   if (is_bool($_to_check))    {return True;} /* ... */ ?>

<?php /* ... */                 if (array_key_exists ($clef$this -> options)                     && is_bool ($opt)) {                     $this -> options[$clef] = $opt; /* ... */ ?>

<?php /* ... */                 if (array_key_exists ($clef$this -> options)                     && is_bool ($opt)) {                     $this -> options[$clef] = $opt; /* ... */ ?>