note 113013 deleted from language.types by salathe
| From: | salathe@php.net | Date: | Tue, 05 Aug 2014 11:28:55 +0000 |
| Subject: | note 113013 deleted from language.types by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-200114@lists.php.net to get a copy of this message | ||
Note Submitter: shaharia dot azam at gmail dot com
----
<?php
/* delcare few variable to check their data type */
$intVar = 10; //Integar variable
$floatVar = 2.49; //Float type aka Double
$stringVar = "There are 8 data types in PHP"; // String
$arrayVar = array(
'Boolean',
'Integar',
'Float aka Double',
'String', 'Array',
'Object',
'Resource',
'Null'
); // Array type
$booleanVar = true; // Boolean type
// Make an empty class to check object type
class obj{
}
$objectVar = new obj();
// To check resource type
$resource = mysql_connect();
// Null value
$nullVar = null;
// output the data type of each variable
echo gettype($intVar);
echo "\n";
echo gettype($floatVar);
echo "\n";
echo gettype($stringVar);
echo "\n";
echo gettype($arrayVar);
echo "\n";
echo gettype($booleanVar);
echo "\n";
echo gettype($objectVar);
echo "\n";
echo gettype($resource);
echo "\n";
echo gettype($nullVar);
echo "\n";