Hướng dẫn how many datatypes are there in php? - có bao nhiêu kiểu dữ liệu trong php?


Kiểu dữ liệu PHP

Các biến có thể lưu trữ dữ liệu của các loại khác nhau và các loại dữ liệu khác nhau có thể làm những việc khác nhau.

PHP hỗ trợ các loại dữ liệu sau:

  • Sợi dây
  • Số nguyên
  • Float (Số điểm nổi - còn được gọi là Double)
  • Boolean
  • Mảng
  • Sự vật
  • VÔ GIÁ TRỊ
  • Nguồn

Chuỗi PHP

Một chuỗi là một chuỗi các nhân vật, như "Hello World!".

Một chuỗi có thể là bất kỳ văn bản bên trong trích dẫn. Bạn có thể sử dụng trích dẫn đơn hoặc đôi:

Thí dụ

$x = "Hello world!";
$y = 'Hello world!';

echo $ x; echo ""; Echo $ y;?>
echo "
";
echo $y;
?>

Hãy tự mình thử »


Số nguyên PHP

Một loại dữ liệu số nguyên là một số không phân giải trong khoảng -2,147,483,648 đến 2.147.483.647.

Quy tắc cho số nguyên:

  • Một số nguyên phải có ít nhất một chữ số
  • Một số nguyên không được có một điểm thập phân
  • Một số nguyên có thể là tích cực hoặc âm
  • Các số nguyên có thể được chỉ định trong: thập phân (cơ sở 10), thập lục phân (cơ sở 16), octal (cơ sở 8) hoặc ký hiệu nhị phân (cơ sở 2)

Trong ví dụ sau $ x là một số nguyên. Hàm php var_dump () trả về kiểu dữ liệu và giá trị:



Php float

Một chiếc phao (số điểm nổi) là một số có điểm thập phân hoặc một số ở dạng theo cấp số nhân.

Trong ví dụ sau $ x là một chiếc phao. Hàm php var_dump () trả về kiểu dữ liệu và giá trị:


PHP Boolean

Một boolean đại diện cho hai trạng thái có thể: đúng hoặc sai.

Booleans thường được sử dụng trong thử nghiệm có điều kiện. Bạn sẽ tìm hiểu thêm về thử nghiệm có điều kiện trong một chương sau của hướng dẫn này.


Mảng PHP

Một mảng lưu trữ nhiều giá trị trong một biến duy nhất.

Trong các ví dụ sau đây $ Cars là một mảng. Hàm php var_dump () trả về kiểu dữ liệu và giá trị:

Thí dụ

$cars = array("Volvo","BMW","Toyota");
var_dump($cars);
?>

Hãy tự mình thử »

Số nguyên PHP


Một loại dữ liệu số nguyên là một số không phân giải trong khoảng -2,147,483,648 đến 2.147.483.647.

Quy tắc cho số nguyên:

Một số nguyên phải có ít nhất một chữ số

Một số nguyên không được có một điểm thập phân

Một số nguyên có thể là tích cực hoặc âm

Các số nguyên có thể được chỉ định trong: thập phân (cơ sở 10), thập lục phân (cơ sở 16), octal (cơ sở 8) hoặc ký hiệu nhị phân (cơ sở 2)

Trong ví dụ sau $ x là một số nguyên. Hàm php var_dump () trả về kiểu dữ liệu và giá trị:

Thí dụ

class Car {
  public $color;
  public $model;
  public function __construct($color, $model) {
    $this->color = $color;
    $this->model = $model;
  }
  public function message() {
    return "My car is a " . $this->color . " " . $this->model . "!";
  }
}

echo $ x; echo ""; Echo $ y;?>
echo $myCar -> message();
echo "
";
$myCar = new Car("red", "Toyota");
echo $myCar -> message();
?>

Hãy tự mình thử »


Số nguyên PHP

Một loại dữ liệu số nguyên là một số không phân giải trong khoảng -2,147,483,648 đến 2.147.483.647.

Quy tắc cho số nguyên:

Một số nguyên phải có ít nhất một chữ số If a variable is created without a value, it is automatically assigned a value of NULL.

Một số nguyên không được có một điểm thập phân


Một số nguyên có thể là tích cực hoặc âm

Các số nguyên có thể được chỉ định trong: thập phân (cơ sở 10), thập lục phân (cơ sở 16), octal (cơ sở 8) hoặc ký hiệu nhị phân (cơ sở 2)

Trong ví dụ sau $ x là một số nguyên. Hàm php var_dump () trả về kiểu dữ liệu và giá trị:

Php float



Có bao nhiêu loại dữ liệu trong PHP?

PHP hỗ trợ 8 loại dữ liệu nguyên thủy có thể được phân loại thêm theo 3 loại: các loại hợp chất (được xác định trước) (định nghĩa người dùng) Các loại đặc biệt.

  • 8 loại dữ liệu trong PHP là gì?
  • Kiểu dữ liệu PHP.
  • Float (số điểm nổi - còn được gọi là gấp đôi).
  • Có bao nhiêu kiểu dữ liệu?

Các loại dữ liệu được chia thành hai nhóm: các loại dữ liệu nguyên thủy - bao gồm byte, ngắn, int, dài, float, gấp đôi, boolean và char. Các loại dữ liệu không định tuyến - chẳng hạn như chuỗi, mảng và lớp (bạn sẽ tìm hiểu thêm về những loại này trong một chương sau)

  • 7 loại dữ liệu là gì?
  • Integer (int) Đây là loại dữ liệu số phổ biến nhất được sử dụng để lưu trữ số mà không có thành phần phân số (-707, 0, 707) ..

Điểm nổi (Float) ....

  • Nhân vật (char) ....
  • Chuỗi (str hoặc văn bản) ....

Boolean (Bool) ....
 

Loại liệt kê (Enum) ....: Integers hold only whole numbers including positive and negative numbers, i.e., numbers without fractional part or decimal point. They can be decimal (base 10), octal (base 8), or hexadecimal (base 16). The default base is decimal (base 10). The octal integers can be declared with leading 0 and the hexadecimal can be declared with leading 0x. The range of integers must lie between -2^31 to 2^31. 

Example:  

PHP

$deci1 = 50;

$deci2 = 654;

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
0
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
1

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
2
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
3

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
5$deci1
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
7$deci2
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

This condition is TRUE
0
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

This condition is TRUE
0
This condition is TRUE
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

This condition is TRUE
6
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
This condition is TRUE
8

This condition is TRUE
9

2. Double: Có thể giữ các số chứa các phần phân số hoặc thập phân bao gồm số dương và số âm hoặc một số ở dạng hàm mũ. Theo mặc định, các biến thêm một số lượng tối thiểu các vị trí thập phân. Kiểu dữ liệu kép giống như một chiếc phao như số điểm nổi hoặc số thực.: Can hold numbers containing fractional or decimal parts including positive and negative numbers or a number in exponential form. By default, the variables add a minimum number of decimal places. The Double data type is the same as a float as floating-point numbers or real numbers.

Example: 

PHP

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
2

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
4

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
5
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
7
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

This condition is TRUE
0
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

This condition is TRUE
0
This condition is TRUE
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

2. Double: Có thể giữ các số chứa các phần phân số hoặc thập phân bao gồm số dương và số âm hoặc một số ở dạng hàm mũ. Theo mặc định, các biến thêm một số lượng tối thiểu các vị trí thập phân. Kiểu dữ liệu kép giống như một chiếc phao như số điểm nổi hoặc số thực.

This condition is TRUE
9

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
2

705.11

float(705.11)

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
4
: Hold letters or any alphabets, even numbers are included. These are written within double quotes during declaration. The strings can also be written within single quotes, but they will be treated differently while printing variables. To clarify this look at the example below. 
 

Example: 

PHP

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
5
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
7
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

This condition is TRUE
6
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
This condition is TRUE
8

Đầu ra

3. Chuỗi: Giữ chữ cái hoặc bất kỳ bảng chữ cái nào, thậm chí các số được bao gồm. Chúng được viết trong các trích dẫn kép trong quá trình tuyên bố. Các chuỗi cũng có thể được viết trong các trích dẫn đơn, nhưng chúng sẽ được xử lý khác nhau trong khi in các biến. Để làm rõ cái nhìn này vào ví dụ dưới đây. & Nbsp; & nbsp;

This condition is TRUE
0
This condition is TRUE
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

This condition is TRUE
62
This condition is TRUE
8

This condition is TRUE
9

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
2

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
4
: Boolean data types are used in conditional testing. Hold only two values, either TRUE(1) or FALSE(0). Successful events will return true and unsuccessful events return false. NULL type values are also treated as false in Boolean. Apart from NULL, 0 is also considered false in boolean. If a string is empty then it is also considered false in boolean data type. 

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
5
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
7
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9
   

PHP

= 50;0= 50;1

This condition is TRUE
6
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
This condition is TRUE
8

= 50;0= 50;7

Đầu ra

This condition is TRUE
9

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
2

This condition is TRUE

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
4
: Array is a compound data type that can store multiple values of the same data type. Below is an example of an array of integers. It combines a series of data that are related together.
  

PHP

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
5
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
7
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

This condition is TRUE
6
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
This condition is TRUE
8

Đầu ra

3. Chuỗi: Giữ chữ cái hoặc bất kỳ bảng chữ cái nào, thậm chí các số được bao gồm. Chúng được viết trong các trích dẫn kép trong quá trình tuyên bố. Các chuỗi cũng có thể được viết trong các trích dẫn đơn, nhưng chúng sẽ được xử lý khác nhau trong khi in các biến. Để làm rõ cái nhìn này vào ví dụ dưới đây. & Nbsp; & nbsp;

This condition is TRUE
6$deci24= 654;9

This condition is TRUE
9

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
2

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
4
 

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
5
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
7
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9
: Objects are defined as instances of user-defined classes that can hold both values and functions and information for data processing specific to the class. This is an advanced topic and will be discussed in detail in further articles. When the objects are created, they inherit all the properties and behaviours from the class, having different values for all the properties.

This condition is TRUE
6
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
This condition is TRUE
8

PHP

Đầu ra

3. Chuỗi: Giữ chữ cái hoặc bất kỳ bảng chữ cái nào, thậm chí các số được bao gồm. Chúng được viết trong các trích dẫn kép trong quá trình tuyên bố. Các chuỗi cũng có thể được viết trong các trích dẫn đơn, nhưng chúng sẽ được xử lý khác nhau trong khi in các biến. Để làm rõ cái nhìn này vào ví dụ dưới đây. & Nbsp; & nbsp;

= 50;2

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
14
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
15
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
06
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
04
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
19

2

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
54
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

This condition is TRUE
0 7
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
04
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
19

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
19

This condition is TRUE
0 $deci10
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9

4. Boolean: Các loại dữ liệu Boolean được sử dụng trong thử nghiệm có điều kiện. Chỉ giữ hai giá trị, đúng (1) hoặc sai (0). Các sự kiện thành công sẽ trả về các sự kiện đúng và không thành công trở lại sai. Giá trị loại NULL cũng được coi là sai trong boolean. Ngoài NULL, 0 cũng được coi là sai trong Boolean. Nếu một chuỗi trống thì nó cũng được coi là sai trong kiểu dữ liệu boolean. & Nbsp;

This condition is TRUE
9

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
2

This is an example of Object Data Type!

First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
4
These are special types of variables that can hold only one value i.e., NULL. We follow the convention of writing it in capital form, but it’s case-sensitive. If a variable is created without a value or no value, it is automatically assigned a value of NULL. It is written in capital letters.

The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
5
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
1
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
7
First Element: 10
Second Element: 20
Third Element: 30

array(3) {
  [0]=>
  int(10)
  [1]=>
  int(20)
  [2]=>
  int(30)
}
3
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9
 

PHP

This condition is TRUE
6
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
4
This condition is TRUE
8

Đầu ra

This condition is TRUE
6
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
45= 654;9

This condition is TRUE
9

3. Chuỗi: Giữ chữ cái hoặc bất kỳ bảng chữ cái nào, thậm chí các số được bao gồm. Chúng được viết trong các trích dẫn kép trong quá trình tuyên bố. Các chuỗi cũng có thể được viết trong các trích dẫn đơn, nhưng chúng sẽ được xử lý khác nhau trong khi in các biến. Để làm rõ cái nhìn này vào ví dụ dưới đây. & Nbsp; & nbsp;: Resources in PHP are not an exact data type. These are basically used to store references to some function call or to external PHP resources. For example, consider a database call. This is an external resource. Resource variables hold special handles for files and database connections.
We will discuss resources in detail in further articles.

Note:  

  • var_dump() function which dumps information about a variable. 
  • 2
    The name of the Geek is Krishna 
    The name of the geek is $name 
    
    string(7) "Krishna"
    54
    The name of the Geek is Krishna 
    The name of the geek is $name 
    
    string(7) "Krishna"
    9

This condition is TRUE
0 7
The name of the Geek is Krishna 
The name of the geek is $name 

string(7) "Krishna"
9Chinmoy Lenka. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to . See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please write comments if you find anything incorrect, or if you want to share more information about the topic discussed above.
 


Có bao nhiêu loại dữ liệu trong PHP?

PHP hỗ trợ 8 loại dữ liệu nguyên thủy có thể được phân loại thêm theo 3 loại: các loại hợp chất (được xác định trước) (định nghĩa người dùng) Các loại đặc biệt.8 primitive data types that can be categorized further in 3 types: Scalar Types (predefined) Compound Types (user-defined) Special Types.

8 loại dữ liệu trong PHP là gì?

Kiểu dữ liệu PHP..
String..
Integer..
Float (số điểm nổi - còn được gọi là gấp đôi).
Boolean..
Array..
Object..
Resource..

Có bao nhiêu kiểu dữ liệu?

Các loại dữ liệu được chia thành hai nhóm: các loại dữ liệu nguyên thủy - bao gồm byte, ngắn, int, dài, float, gấp đôi, boolean và char.Các loại dữ liệu không định tuyến - chẳng hạn như chuỗi, mảng và lớp (bạn sẽ tìm hiểu thêm về những loại này trong một chương sau)two groups: Primitive data types - includes byte , short , int , long , float , double , boolean and char. Non-primitive data types - such as String , Arrays and Classes (you will learn more about these in a later chapter)

7 loại dữ liệu là gì?

Integer (int) Đây là loại dữ liệu số phổ biến nhất được sử dụng để lưu trữ số mà không có thành phần phân số (-707, 0, 707) ..
Điểm nổi (Float) ....
Nhân vật (char) ....
Chuỗi (str hoặc văn bản) ....
Boolean (Bool) ....
Loại liệt kê (Enum) ....
Mảng.....