Showing posts with label display. Show all posts
Showing posts with label display. Show all posts

Sunday, September 7, 2008

The print Function

The print function is used to print one or more variable in the output.
Syntax: print variablename;

Example inputs:
1.
print “smith”;
2.
$name = “Jones”;
print $name;
3.
$name=”Natasha”;
print “My name is $name”;
print “

print “What is yours?”;

Example outputs:

1.
Smith
2.
Jones
3.
My name is Natasha
What is yours?

Some PHP Exercises

What does an echo function do?
What is the difference between using single quotes and double quotes in the echo function?

Friday, September 5, 2008

The echo function

The echo function is used to print one or more variable in the output.
Syntax: echo variable-name;
Example inputs
1.
echo “smith”;
2.
$name = “Jones”;
echo $name;
3.
$name=”Natasha”;
echo “My name is $name”;
echo “

echo “What is yours?”;
4.
$name = “Robin”;
echo ‘My name is $name’
5.
echo ‘My’,’name’,’is’,’John’;
Example outputs:
1.
Smith
2.
Jones
3.
My name is Natasha
What is yours?
4.
My name is $name
5.
My name is John