.: Back one page :.


QUOTES, STRINGS & VARIABLES ::

1   2   3


A variable can be thought of as an imaginary spreadsheet cell, the contents of which you can call on when needed.

Variables in PHP begin with a dollar sign -- $

If you wanted a variable to contain a name, you can assign it like this:

$name = "John Doe";

The variable is called $name -- and the content of the cell is - John Doe. Note - don't start a variable with a number - $3

Note that a variable needs to be enclosed inside double quotes to allow it to expand and deliver a proper result.
 

<?php

 

 

$name = "John Doe";

 

 

echo "$name";

All OK ->

www.fuse7.co.uk

 

 

 

 

but this ...

 

 

 

 

echo '$name';

WON'T WORK!

www.fuse7.co.uk

?>

 

 

www.fuse7.co.uk


Assigning just a name to a variable isn't very interesting so a more useful example follows:
 

.: Next page :.