PHP Variables
Variables start with a dollar sign. You do not declare a type: PHP works it out from the value.
ExamplePHP
<?php
$name = "Ada";
$age = 36;
$height = 1.68;
$student = false;
echo "$name is $age years old\n";
echo "Height: $height\n";
var_dump($student);
var_dump($age);
$age = "now a string";
var_dump($age);
const YEAR = 2026;
echo YEAR . "\n";Output
Ada is 36 years old Height: 1.68 bool(false) int(36) string(12) "now a string" 2026
Quick check
How does a PHP variable name begin?
Finish the quick check (and any code exercise) to complete this lesson, or mark it done yourself.
Tip: use the left and right arrow keys to move between lessons.