1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
|
<?php
function zahl($var)
{
if (preg_match("=^[0-9]+$=i",$var)) {
return TRUE;
} else {
return FALSE;
}
}
$id = "4";
$text = "Mülltonne";
if (zahl($id)) {
echo "Die Variable \"id\" ist <b>eine</b> Zahl.<br>";
}
if (!zahl($text)) {
echo "Die Variable \"text\" ist <b>keine</b> Zahl.";
}
?> |