Recherche sur les Noms des fonctions php/mysql
is_int()
Définition
Détermine si une variable est de type nombre entier - (PHP 4, PHP 5)Description
Détermine si la variable donnée est de type nombre entier.
Note: Pour tester si une variable est un nombre ou une chaîne numérique (comme les entrées de formulaire, qui sont toujours des chaînes), vous devez utiliser la fonction is_numeric().
Liste de paramètres
- var
-
La variable à évaluer.
Valeurs de retour
Retourne TRUE si var est un entier, FALSE sinon.
Exemples
Exemple #1 Exemple avec is_int()
<?php
if (is_int(23)) {
echo "est un entier\n";
} else {
echo "n'est pas un entier\n";
}
var_dump(is_int(23));
var_dump(is_int("23"));
var_dump(is_int(23.5));
var_dump(is_int(true));
?>
L'exemple ci-dessus va afficher :
est un entier bool(true) bool(false) bool(false) bool(false)
Bouts de code utilisant la fonction is_int()
<?php /* ... */
$div_2 = $num/2;
if(is_int($div_2)){
echo $num." est paire !";
/* ... */ ?>
<?php /* ... */
$ma_variable = 256;
if(is_int($ma_variable))
echo 'true';
/* ... */ ?>
<?php /* ... */
foreach ($aPos as $clef => $val) {
if (is_int ($val) && array_key_exists ($clef, $this -> aPos)) {
$this -> aPos[$clef] = $val;
/* ... */ ?>
<?php /* ... */
|| (get_class ($this) === 'mssql'
&& is_int ($qry))) {
$num = $this -> private_num_rows ($qry);
/* ... */ ?>
<?php /* ... */
|| (get_class ($this) === 'mssql'
&& is_int ($qry))) {
$num = $this -> private_num_rows ($qry);
/* ... */ ?>
Connexion
Les fonctions
Références
- debug_zval_dump
- doubleval
- empty
- floatval
- get_defined_vars
- get_resource_type
- gettype
- import_request_variables...
- intval
- is_array
- is_binary
- is_bool
- is_buffer
- is_callable
- is_double
- is_float
- is_int
- is_integer
- is_long
- is_null
- is_numeric
- is_object
- is_real
- is_resource
- is_scalar
- is_string
- is_unicode
- isset
- print_r
- serialize
- settype
- strval
- unserialize
- unset
- var_dump
- var_export





