There is generally various types of data types are present in php like-
Strings, Array, Boolean, Integer ,Object and Null.
A String is a type of data. A string can contain letters, numbers or characters. A string can be short or long.
Here is the example of string:
$stringA = “Hello World”;?>
An Array is a collection of data values, organized as an ordered collection of key-value pairs.
Here is the Example of Array:
$bikes=array(“Yamaha”.”Hero”,”TVS”,”Honda”);
The boolean data type represents only two values that can be either 1 or 0.Boolean values are used mainly to compare conditions for use in conditional statements. For example, PHP evaluates an expression, such as $a > $b, so the output is either TRUE or FALSE.
The number which do not contain any decimal point is called Integer.
Integer can be possitive or negative but integer do not contain any comma and blank. It can be express any of the three formats i.e. decimal, haxadecimal, octal.
An Object is a php data type that store the data and information, object should be explicitly declare.
<?php
class a {}
class b extends a
{
function sayHelloWorld()
{
print "HelloWorld";
}
}
$x = new a();
$x->sayHelloworld();
?>
NULL value shows that variable has no value.
<?php
$a=”Hello!”;
$a=null;
var_dump($a);
?>