Data Types

Data Types

Data types define what information is stored

The most used of them are:

Type Description Example
numeric Whole or floating point number. $var = 5;

$var = 2.45;
string Sequence of symbols (text). $var = 'PHP is awesome!';
boolean Can have only 2 values - true or false. $var = true;

Printing Data

It's done using echo.

Variables

The variables are used to store data of certain type.

Their value can be changed any time.

Example of variables definitions:

Basic program example:

Write a program in which variables are defined and printed.

Solution:

Output: