PHP theorytheory 0/50 · 0%
Fundamentals · easy

2. Variables & Constants

Storing and naming values.

Variables in PHP start with a dollar sign, e.g. $name, and are case-sensitive. They do not need explicit type declarations because PHP is dynamically typed.

Constants are defined with define() or the const keyword and cannot be changed once set, making them useful for configuration values.

Check your understanding

  1. 1. How do you declare a variable named age?

  2. 2. Which defines a constant?