Variables and Constants
Learn how to use variables and constants in PHP.
1
Variables and Constants
Welcome to a new chapter in your PHP journey! In this lesson, you’ll learn how to use variables to store data and constants to define unchangeable values. Let’s get started!

2
What Are Variables?
Variables are used to store data that can change during the execution of a script. In PHP:
- Variable names start with a $ symbol.
- They can store different types of data like strings, numbers, and arrays.
Example:
<?php
$name = "Alice";
$age = 25;
echo "Name: $name, Age: $age";
?>
All lessons in this course
- Variables and Constants
- Data Types
- Operators
- Control Structures
- Working with Arrays