PHP Eight types of data

Source: Internet
Author: User
Tags scalar
Understanding PHP Data Types

in PHP, there are altogether eight primitive data types supported: They are 4 scalar types, Boolean (Boolean), Integer (integer), float (float), and string (string), two conforming types, array (arrays), and Object (objects); Two special types, resource (Resource) and null (NULL).

The data type of a variable in PHP is usually not set by the programmer, and, to be exact, PHP is determined at runtime by the context in which it is used, which simply means that we do not need to set the data type of the variable and PHP will automatically recognize it.

Four types of scalar data

Boolean (Boolean)

Also called bool type, there are only two values, true or FALSE, which are not case sensitive

Strings (String type)

A string is a sequential sequence of characters, consisting of numbers, letters, and symbols.

Integer (integer type)

Integral is the integer that we often say, it can only be an integer

Float (float type)

Floating-point data types are our common decimals, which can be used either to store integers or to store decimals.


Two types of data compliance

Array (arrays)

An array is a combination of data that combines a series of arrays to form an operable whole.

Object (Objects)

object is an entity used to describe objective things in the system, which is a basic unit of the system. An object consists of a set of properties and a set of services that operate on that set of properties.


Two special types of

Resource (resources)

A resource is a special type of variable that holds a reference to an external resource, such as opening a file, a database connection, a graphics canvas area, and so on.

Null value (NULL)

NULL, in the name of which it simply does not have a value, which means that no value is set for the variable.


Above we have a simple understanding of the eight kinds of PHP raw data types, we will detail consider on these eight types of data, the next section, we first introduce you to four types of scalar data type "Boolean".

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.