PHP is_numeric() Fonksiyon
❮ PHP Değişken İşleme Referansı
Örnek
Bir değişkenin bir sayı mı yoksa sayısal bir dize mi olduğunu kontrol edin:
<?php
$a = 32;
echo "a is " . is_numeric($a) . "<br>";
$b = 0;
echo "b
is " . is_numeric($b) . "<br>";
$c = 32.5;
echo "c is " . is_numeric($c)
. "<br>";
$d = "32";
echo "d is " . is_numeric($d) . "<br>";
$e = true;
echo "e is " . is_numeric($e) . "<br>";
$f = null;
echo "f is " . is_numeric($f) . "<br>";
?>
Tanım ve Kullanım
is_numeric() işlevi, bir değişkenin sayı mı yoksa sayısal bir dize mi olduğunu kontrol eder.
Bu işlev, değişken bir sayı veya sayısal bir dize ise true (1) döndürür, aksi takdirde false/hiçbir şey döndürür.
Sözdizimi
is_numeric(variable);
Parametre Değerleri
Parameter | Description |
---|---|
variable | Required. Specifies the variable to check |
Teknik detaylar
Geri dönüş değeri: | Değişken bir sayı veya sayısal bir dize ise DOĞRU , aksi takdirde YANLIŞ |
---|---|
İade Türü: | Boole |
PHP Sürümü: | 4.0+ |
❮ PHP Değişken İşleme Referansı