oujood.com

Détermine si une variable est un booléen

La fonction is_bool() permet de déterminer si une variable est de type booléen, la fonction is_bool() retourne true si la variable est un booléen

chercher |

PHP cours tutorial

La fonction is_bool()

(PHP 4, PHP 5)

La fonction is_bool() détermine si une variable est un booléen

Syntaxe :

is_bool($var )

 

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

L’argument $var c’est la variable à évaluer. 

La fonction is_bool ( )retourne TRUE si la variable $var est un booléen, FALSE sinon.

 

Exemple :

<?php

$a = false;

$b = 0;

 

// Si $a est un booléen, is_bool retournera true

if (is_bool($a) === true) {

    echo "Oui, c'est un booléen.";

}

echo '<br />';

// Si $b n'est pas un booléen, is_bool retournera false

if (is_bool($b) === false) {

    echo "Oui, c'est un booléen.";

}

?>



Cours precedent:
  La fonction is_array()

    Fonctions de manipulation des variables en PHP

 Cours suivant:
La fonction is_callable()   

Par carabde 20 Aout 2014

MARKETPOWER-IA
Logiciel d'I.A.
Logiciel d'I.A. 100% Français pour lancer son business en ligne

La méthode secrète likes sans fin sur Facebook

Livre numérique court pour comprendre la méthode secrète permettant d'obtenir des likes sans fin sur Facebook.

GAGNER DE L'ARGENT
GRÂCE À FACEBOOK 
N'A JAMAIS ÉTÉ SI FACILE


Consulter


1tpe