Przeglądaj źródła

fixed int and float check

master
Robin Thoni 9 lat temu
rodzic
commit
b58ed4ace8
1 zmienionych plików z 7 dodań i 2 usunięć
  1. 7
    2
      utils.php

+ 7
- 2
utils.php Wyświetl plik

38
   return get_param($_GET, $key, $is_error);
38
   return get_param($_GET, $key, $is_error);
39
 }
39
 }
40
 
40
 
41
-function check_float($f)
41
+function check_float($f, $def = null)
42
 {
42
 {
43
-  return ($f == (string)(float)$f) ? $f : null;
43
+  return ($f == (string)(float)$f) ? $f : $def;
44
+}
45
+
46
+function check_int($i, $def = null)
47
+{
48
+  return is_numeric($i) ? $i : $def;
44
 }
49
 }
45
 
50
 
46
 function check_table_field($header, $table, $field)
51
 function check_table_field($header, $table, $field)

Ładowanie…
Anuluj
Zapisz