Variables

Variables are used to store and manipulate data. They are containers that hold values, such as numbers, strings, arrays, objects, and more. Variables are an essential component of programming, allowing to store and retrieve information as needed throughout the code.

Variables in PHP must start with a dollar sign $ followed by the variable name. The name should begin with a letter or an underscore and can contain letters, numbers, and underscores. PHP variable names are case-sensitive.

PHP is a loosely typed language, which means you don’t need to explicitly declare the type of a variable. PHP determines the variable’s type based on the assigned value.

<?php

$a = 'a';
// more calculations
echo a;

?>

Documentation

Related : Static Variables, Variable Variables, Type System, Naming, Interpolation