Table of Contents

PHP Variables

A PHP variable is simply enough a container to store a value in. Let's go ahead and create our first variable.

So to create a PHP variable, we will start it off with $, add the name of the variable, and then give it a value. Here's an example:

$name = 'DevDojo';

This variable's name is name, and the value we gave it is DevDojo.

After creating our first variable, we can echo it out.


$name = 'DevDojo';

echo $name;


This will print out the value (DevDojo) that we gave the variable.