Learn Before
Concept

PHP Variables

A variable's name might be short (like x and y) or longer (like age, car name, or total volume).

PHP variable rules:

  • A variable starts with the dollar sign or a letter must come first in a variable name.
  • No number may begin a variable name.
  • Only underscores (A-z, 0-9, and _) and alphanumeric characters are permitted in variable names.
  • The capitalization of variable names (ageandage and AGE are two distinct variables)
<?php $txt = "1cademy.com"; echo "I love $txt!"; ?>

0

1

Updated 2023-01-26

References


Tags

Object-Oriented Programming (OOP) Languages

Related