Showing posts with label php variables. Show all posts
Showing posts with label php variables. Show all posts

Sunday, June 16, 2013

php variables

php variables
In this lesson I will talk about variables in php, and firstly i will describe what is a variable in php
A variable in php start with $ sign and the name of the variable

For example $pass = 12;
In this example we have define a variable calls pass and we gave him a value of 12, so if we write
echo "pass";

what we will see in the screen?

To find out write this code in a new document or the same of the previous lesson
<?php
$pass = "12" ;
echo "$pass" ;
?>
go to your navigator and type localhost/name.php you should see some thing like this


you see 12 in the screen good, but have you wonder if we write echo '$pass' ; instead of echo "$pass" ;
what is the difference between " and '
well let's try
As you see we have $pass instead of 12, so the difference between them is 
" give us the value of the variable
' give us the word as it is 

In the next lesson we will learn some operation to use with php variables.

Read More