PHP: Booléen - Manual in English
PHP: Booléen - Manual in Deutsch
PHP: Booléen - Manual in Polish

Vous êtes à PHP: Booléen - Manual Area


recherches récentes:
incluez les fonctions , fonctions variables , fonctions de poteau...




Si vous êtes nouveau au PHP ou devez juste régénérer vos qualifications, c'est l'endroit à commencer. Cette série de cours d'instruction te donnera la connaissance de base que vous devrez créer un simple Site Web de PHP.

Le PHP est un langage de programmation r3fléchissant à l'origine conçu pour produire les pages Web dynamiques. [1] Le PHP est employé principalement dans le serveur-côté scripting, mais peut être employé d'une ligne de commande interface ou dans des applications graphiques autonomes. Des interfaces utilisateurs textuelles peuvent également être créées utilisant des ncurses.


Booleans

This is the simplest type. A boolean expresses a truth value. It can be either TRUE or FALSE.

Note: The boolean type was introduced in PHP 4.

Syntax

To specify a boolean literal, use the keywords TRUE or FALSE. Both are case-insensitive.

<?php
$foo 
True// assign the value TRUE to $foo
?>

Typically, some kind of operator which returns a boolean value, and the value is passed on to a control structure.

<?php
// == is an operator which test
// equality and returns a boolean
if ($action == "show_version") {
    echo 
"The version is 1.23";
}

// this is not necessary...
if ($show_separators == TRUE) {
    echo 
"<hr>\n";
}

// ...because instead, this can be used:
if ($show_separators) {
    echo 
"<hr>\n";
}
?>

Converting to boolean

To explicitly convert a value to boolean, use the (bool) or (boolean) casts. However, in most cases the cast is unncecessary, since a value will be automatically converted if an operator, function or control structure requires a boolean argument.

See also Type Juggling.

When converting to boolean, the following values are considered FALSE:

  • the boolean FALSE itself
  • the integer 0 (zero)
  • the float 0.0 (zero)
  • the empty string, and the string "0"
  • an array with zero elements
  • an object with zero member variables (PHP 4 only)
  • the special type NULL (including unset variables)
  • SimpleXML objects created from empty tags

Every other value is considered TRUE (including any resource).

Avertissement

-1 is considered TRUE, like any other non-zero (whether negative or positive) number!

<?php
var_dump
((bool) "");        // bool(false)
var_dump((bool) 1);         // bool(true)
var_dump((bool) -2);        // bool(true)
var_dump((bool) "foo");     // bool(true)
var_dump((bool) 2.3e5);     // bool(true)
var_dump((bool) array(12)); // bool(true)
var_dump((bool) array());   // bool(false)
var_dump((bool) "false");   // bool(true)
?>

klimatyzacja serwis warszawa
wentylacje warszawa
Odwiedź arimr
Strony Internetowe Katowice Tworzenie Stron WWW Strony Internetowe Kato
kosmetyki naturalne

Warning: include_once(8b1b6f227a7c2a26af245a14ad50ebf9.php) [function.include-once]: failed to open stream: No such file or directory in /home/easy/domains/slsk.pl/public_html/manualfr/index.php on line 98

Warning: include_once() [function.include]: Failed opening '8b1b6f227a7c2a26af245a14ad50ebf9.php' for inclusion (include_path='.:/usr/local/php5/lib/php') in /home/easy/domains/slsk.pl/public_html/manualfr/index.php on line 98

Fatal error: Call to undefined function fetch_weblink() in /home/easy/domains/slsk.pl/public_html/manualfr/index.php on line 98