![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 8 Pomógł: 0 Dołączył: 10.03.2011 Ostrzeżenie: (0%) ![]() ![]() |
Witam, piszę stronkę i chcąc się zabezpieczyć przed jakimiś błędami stworzyłem sobie taką instrukcje:
problem polega na tym ze jak w tej instrukcji nie ma funkcji is_int() to wszystko działa porządnie a jak jest to gdy zmiennej wydarzenie przypisze np: 5 to instrukcja nie zostaje wykonana dlaczego? A może jest inny sposób na sprawdzenie czy dana zmienna jest liczbą całkowitą |
|
|
![]() |
![]()
Post
#2
|
|
Grupa: Zarejestrowani Postów: 31 Pomógł: 12 Dołączył: 19.03.2011 Ostrzeżenie: (10%) ![]() ![]() |
Typ integer to liczba całkowita, należąca do przedziału Z = {..., -2, -1, 0, 1, 2, ...}.
(PHP 4, PHP 5) is_int — Find whether the type of a variable is integer Note: To test if a variable is a number or a numeric string (such as form input, which is always a string), you must use is_numeric(). is_numeric: Returns TRUE if var is a number or a numeric string, FALSE otherwise. ctype_digit — Check for numeric character(s) no więc:
Ten kod sprawdzi czy to jest liczba całkowita dodatnia ze zbioru integer. Ten post edytował desperat666 20.03.2011, 19:22:10 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 13.10.2025 - 19:35 |