What kind of information do you want to store in a variable? These define you through data types.If you want to store any number of a variable or you want to store the character then So you represent the compiler through the data types. PHP has 8 kinds of data types. There are 4 scalar types, 2 are compound types and 2 are special types.
Scalar types:-
Scalar data types are also called base types. These data types provide a programming language by default. Such data types hold a single value. Such as int, char, float, boolean etc.
1.Integer:- Integers are used to store a number.You can not store decimal numbers in integer variables.
In PHP, you can create integer variables this way.
2.Float:- Variables of float types are used to store decimal numbers. In PHP, you can store floating point variables this way.
3.Boolean:- Variables of Boolean types You can store in true and false variables of a value boolean type.
4.String:- You can store string in strings of variables. In PHP, you can create string types of variables in this way.
Compound types:-
Compound data types are those data types that you use in programming, while using the programming language. Arrays, objects, structure, linked-lists, etc.
1.Array:- In PHP, you store the values of an array by keys. You can also use arrays in PHP as a list.
2.Object:-In PHP, you can also create object types, to create Object types, you must first create a class.Creating classes and objects in PHP is as easy as any other programming language
Special types
Which are made for one particular language.They are called special type data types.How PHP works with special data types. I will tell you one by one.
1.Resource:- A resource is a special type that holds external resources. Just like the database connection or files that you open with the PHP code
2.NULL:- If you have created a variable but you do not want to initially store a value store, then you can store NULL in it. NULL means that there is no value of that variable.