DATA TYPES IN PHP

Data types in php


Data types in php is the type of data available can store. Each data types can do different things.

  • Integer

Is basically a whole number without a decimal point and  it also include positive and negative numbers e.g (2,3,-4,-5).

Syntax

<?php

$x=10;

Echo $X;

?>

  • Double

Is the number with multiple decimals. They are also known as float.

Syntax

<?php

$x=10.0;

$y=30.0;

$z=$x+$y;

Echo $z;

?>

  • String

Is the type of data types that consists of letters or any alphabets .

Syntax

<?php

$name=”bola”;

Echo “the name of the girl is:” .  $name;

?>

N/b: They are written with double or single quotes during declaration.

  • Boolean

Are data types used in conditional testing. It can either be true or false.

  • Null

Is the types of data type that has no value assigned to it  i.e  empty

Syntax

<?php

$x=”    ”;

?>