← PHP learning path
PHP · Module 2 of 10

Variables, types and strings

Store data and build strings.

📖 Key ideas

  1. Variables start with $: $name = "Asha";
  2. Types: int, float, string, bool, array, null.
  3. Double quotes interpolate: "Hi $name"; single quotes don't.
  4. Concatenate with the dot operator: "Hi " . $name.
  5. var_dump shows type and value.
💡 Real-life example: PHP variables wear a $ badge so the server can spot them easily.
$variablePHP variable syntax
ConcatenationJoining strings with .
var_dumpShows type and value
InterpolationVariables inside double-quoted strings