Variables and Data Types in PHP
Understand variables, strings, numbers, booleans, and how PHP handles types.
Sophia Miller
Nov 16, 2025
11.5k263
Variables store data. In PHP, they always start with a $ sign.
Creating variables
<?php
$name = "John";
$age = 25;
$isStudent = true;
?>
Common data types
- string: "Hello"
- integer: 10
- float: 3.14
- boolean: true / false
- array: list of values
- null: no value
Using variables
<?php
echo "My name is $name and I am $age years old.";
?>
PHP replaces variables inside double quotes.
Type checking
var_dump($age);
Shows type and value.
Next: Operators and basic math in PHP.
#PHP#Variables#Beginner