Data Type in PHP


We are ready to know about the data type of PHP. Plz see the code in below-

1. First make a page name datatype.php

2. Then write these code in this file.

//this tutorial is ready to check php data type
$var=”This is a variable”;
echo gettype($var);

//output: string

3. Then save this file.

4. And finally run this file with browser.


First I use a php variable $var and put some string. Then use a function named ‘gettype()’ and put this variable in this function and finally print this function. The expected output is ‘string’.

You can check integer, float accordingly .



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s