Home » PHP Tutorial » PHP Data Types | Integer | String | Array | Boolean | Float Example

PHP Data Types | Integer | String | Array | Boolean | Float Example

PHP Data Type Example

We are sharing PHP DataType Example for beginners.

PHP Data Types – CodeMirch

Hello Guys, Today We are discussing one of the most important chapters in PHP Data Types.In this session We are showing the data types example with variable. Let’s Check our PHP Example.

PHP DataType And Variable Example :


Watch This Video : https://youtu.be/eY2L8H_5lEM



$variable = 10;


In this section We defined variable and its value. We can easily find Which type of data types is used. Let’s see our example.

$variable = 10; – Integer Data type. Here we used the 10 value means – (the numeric value in variable).

Another Way We can See the data type in PHP (gettype() function).

Example Gettype () inbuilt PHP Function:


$variable = “Hello PHP”;

echo gettype($varable);


gettype () function always shows the variable data type in PHP.So it is an easy way to find that which variable is which data type.

PHP List Of Data Types:

  1. Integer
  2. Float
  3. Double
  4. String
  5. Array
  6. Object
  7. Boolean
  8. Null

PHP String Data Types Example

The String is a combined of Character. Here We are Showing String Data Type Example. Lets See


$string_char = “The is a String”;

Echo $string_char;

Echo gettype($string_char); // return data type only string


PHP Integer Data Type Example

Here We are giving the example of  integer data types. Let’s Check Our PHP Code


$var = 50;

Echo gettype($var);


In this section We can find an integer data type by gettype() function. Gettype function always return only variable data type.

PHP float Or double Data Type Example :

Here We use the float variable using PHP Code. Let’s See example.


$float_var = 12.76;

Echo gettype($float_var);


In a same way we can find float or double data type.

PHP boolean Data Type Example :

Boolean data type always returns true or false.Now See Our Example


$var = true;

$var_2 = false;


PHP Array Data Type Example :

The Array is a one type of variable that can contain multiple of value. Lets Check it.


$arr = array(“name”=>”RAM”,  “Class”=> “xii”);



In this section we used var_dump that return the data type also using the array variable.


PHP Object Data Type Example :

The Object is a one type of data type that return object. Lets See Our Example


class person {

function person()


$this -> eyes = ” TO SEE”;



$obj = new person() ; // here object is created.

// Calling the Object Properties

Echo $obj->eyes;


PHP Null Data Types Example :

The Null data type always returns only one value Null. Lets see Example


$test = null ;

var_dump ($test);


Watch Our Live Streaming, PHP Tutorial :



, , , , , , , , ,


  1. judi bola says:

    I’m extremely pleased to uncover this site.
    I wanted to thank you for ones time due to this
    fantastic read!! I definitely liked every bit of it
    and i also have you saved as a favorite to see new stuff on your website.

  2. admin says:

    Thank you judi bola Like Our PHP Data type Tutorial …. Its our Pleasure 👍👍 Keep it up to share your thought .. Nice ..

  3. online article says:

    Hello! I could have sworn I’ve been to this website
    before but after reading through some of
    the post I realized it’s new to me. Anyways, I’m definitely happy
    I found it and I’ll be bookmarking and checking back often!

  4. situs judi bola online says:

    This is a topic that is near to my heart…
    Best wishes! Exactly where are your contact details

  5. coin master hack tool v1.9 download free pc says:

    It’s an remarkable article for all the web users; they will get benefit from it I am sure.

  6. holiday dress says:

    Hello to every , because I am actually keen of reading this
    web site’s post to be updated daily. It carries pleasant stuff.

  7. زيادة تحميلات التطبيقات says:

    Way cool! Some very valid points! I appreciate you penning this article plus the rest of the site is very good.

  8. single small business says:

    I’m not that much of a online reader to be honest
    but your blogs really nice, keep it up! I’ll go ahead and bookmark your website to come back
    later on. Many thanks

  9. Top Shelf Bread says:

    I am delighted that I found this weblog, exactly the right info that I was looking for!

  10. www.pearltrees.com says:

    I am really impressed with your writing skills
    and also with the layout on your weblog. Is this a paid theme or did you customize it yourself?
    Anyway keep up the excellent quality writing, it’s rare to see
    a nice blog like this one today.

  11. perfect futures indicator says:

    I need to to thank you for thks wonderful read!! I definitely loved every
    bit of it. I have got you saved as a favorite to look at new stuff you

Leave a Reply

Your email address will not be published. Required fields are marked *