PHP is_string() Functie
❮ Referentie voor het afhandelen van PHP-variabelen
Voorbeeld
Controleer of een variabele van het type string is of niet:
<?php
$a = "Hello";
echo "a is " . is_string($a) . "<br>";
$b = 0;
echo "b is
" . is_string($b) . "<br>";
$c = 32;
echo "c is " . is_string($c) .
"<br>";
$d = "32";
echo "d is " . is_string($d) . "<br>";
$e =
true;
echo "e is " . is_string($e) . "<br>";
$f = "null";
echo "f
is " . is_string($f) . "<br>";
$g = "";
echo "g is " . is_string($g)
. "<br>";
?>
Definitie en gebruik
De functie is_string() controleert of een variabele van het type string is of niet.
Deze functie retourneert true (1) als de variabele van het type string is, anders wordt false/niets geretourneerd.
Syntaxis
is_string(variable);
Parameterwaarden
Parameter | Description |
---|---|
variable | Required. Specifies the variable to check |
Technische details
Winstwaarde: | TRUE als variabele een string is, anders FALSE |
---|---|
Retourtype: | Booleaans |
PHP-versie: | 4.0+ |
❮ Referentie voor het afhandelen van PHP-variabelen