Courses Job Ready Fresher Training AI for Class 7 to 12 Corporate Training Placements Tutorials
Free Learning Resources

IT Tutorials & Interview Prep

Free guides, interview Q&As, and job responsibility breakdowns — curated by industry veterans to help you crack MNC interviews

109+
Tutorial Articles
9
Topic Categories
100%
Free to Read
← Back to PHP

Variables in PHP

PHP Last Updated: Oct 17, 2025

Variables in PHP

Variables are containers that can store information which can be manipulated or referenced later by the programmer within the code.

In PHP, we don’t need to declare the variable type explicitly. The type of variable is determined by the value it stores. There are some important things to know about variables in PHP.

  • All variables should be denoted with a Dollar Sign ($)
  • Variables are assigned with the = operator, with the variable on the left-hand side and the expression to be evaluated on the right.
  • Variable names can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ ).
  • Variables must start with a letter or the underscore _ character.
  • Variables are case sensitive.
  • Variable names cannot start with a number.

For Example:

<?php
$txt = "Hello world!";  # Type String
$x = 5;                 # Type int
$y = 10.5;              # Type Float
?>

Want to practice these scenarios in a real IT environment? Our 45-Day Internship Program gives you hands-on experience with Active Directory, Ticketing Tools, and Networking.
Join the Internship →