3.3. Data Types and Functions

In the previous sections you have already seen that PHP supports variables, but so far you have only learned to use numbers and strings. Just like control structures, data types are a core component of every programming language.

Like most other high-level languages, PHP works to a large extent without types and tries to recognize the data type of a variable by itself. However, PHP provides a set of different data types, as shown in Table 3.1.

Table 3.1. Data Types in PHP
Data Type Description
Int, integer Numeric values with no commas
Double, real Floating-point number
String A sequence of characters
Array A pool of values
Object A artificial, user-defined data type

In this section you will learn to use these data ...

Get PHP and PostgreSQL: Advanced Web Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.