0% found this document useful (0 votes)
47 views

Data Types: Etl Labs PVT LTD - PHP

This document defines and describes 7 common PHP data types: integers, floats, strings, NULL, Booleans, and arrays. Integers are whole numbers, floats have decimals, strings are text, NULL means a variable has no value, Booleans can be true or false, and arrays store multiple values in a single variable.

Uploaded by

ETL LABS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
47 views

Data Types: Etl Labs PVT LTD - PHP

This document defines and describes 7 common PHP data types: integers, floats, strings, NULL, Booleans, and arrays. Integers are whole numbers, floats have decimals, strings are text, NULL means a variable has no value, Booleans can be true or false, and arrays store multiple values in a single variable.

Uploaded by

ETL LABS
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

Data Types

ETL LABS PVT LTD – PHP 39


Data Types

1 2 3

Integer Float (floating point numbers - also called double) String

4 5 6

NULL Boolean Array

ETL LABS PVT LTD – PHP 40


Integer
An integer data type is a non-decimal number
between -2,147,483,648 and 2,147,483,647.
Rules for integer
2 • An integer must have at least one digit
• An integer must not have a decimal point
• An integer can be either positive or
negative
• Integers can be specified in three formats:
decimal (10-based), hexadecimal (16-
based - prefixed with 0x) or octal (8-based
- prefixed with 0)

ETL LABS PVT LTD – PHP 41


Float (floating point numbers
- also called double)
A float (floating point number) is a number with
3
a decimal point or a number in exponential
form.

In the following example $x is a float. The PHP


var_dump() function returns the data type and
value:

ETL LABS PVT LTD – PHP 42


String
A string is a sequence of characters, like
"Hello world!".
4
A string can be any text inside quotes. You can
use single or double quotes

ETL LABS PVT LTD – PHP 43


NULL
Null is a special data type which can have only
one value: NULL.

A variable of data type NULL is a variable that 5


has no value assigned to it.

If a variable is created without a value, it is


automatically assigned a value of NULL.

ETL LABS PVT LTD – PHP 44


Boolean
A Boolean represents two possible
states: TRUE or FALSE.
6

ETL LABS PVT LTD – PHP 45


Array
An array stores multiple values in one single
variable.

In the following example $cars is an array. The 7


PHP var_dump() function returns the data type
and value

ETL LABS PVT LTD – PHP 46

You might also like