|
|
|
Example:
// gettype($a) return a string describing the data type of the variable $a
<?php
$a = 12;
print ("a = " . $a . " Type of a = " . gettype($a) . "\n");
$a = 12.0;
print ("a = " . $a . " Type of a = " . gettype($a) . "\n");
$a = "12";
print ("a = " . $a . " Type of a = " . gettype($a) . "\n");
$a = true;
print ("a = " . $a . " Type of a = " . gettype($a) . "\n");
?>
|
Output:
a = 12 Type of a = integer <-- The data type changes !!! a = 12 Type of a = double a = 12 Type of a = string a = 1 Type of a = boolean |
How to run the program:
|
|
|
|