-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathData_Type.php
50 lines (40 loc) · 1.05 KB
/
Data_Type.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
// gettype returns the type of data, e.g. STRING, FLOAT, BOOL, etc...
$a = "This is a String";
echo gettype($a) . "<br/>";
// is_X functions, returns 1 if true, and does not return anything if false
// Integer
$b = 5;
echo gettype($b) . "<br/>";
echo is_int($b) . "<br/>";
// Float
$c = 2.5;
echo gettype($c) . "<br/>";
echo is_float($c) . "<br/>";
// Bool
$d = false;
echo gettype($d) . "<br/>";
echo is_bool($d) . "<br/>";
// Bool
$e = "Sample String";
echo gettype($e) . "<br/>";
echo is_string($e) . "<br/>";
// Numeric
$f = "241";
echo gettype($f) . "<br/>";
echo is_numeric($f) . "<br/>";
// Numeric
$f = "241";
echo gettype($f) . "<br/>";
echo is_numeric($f) . "<br/>";
// NULL, has no value
$g;
echo gettype($g) . "<br/>";
echo is_null($g) . "<br/>";
// NULL, has no value
$h = array(12, "24", false);
echo gettype($h) . "<br/>";
echo is_null($h) . "<br/>";
unset($a);
echo gettype($a) . "<br/>";
?>