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?
Showing posts with label display. Show all posts
Showing posts with label display. Show all posts
Sunday, September 7, 2008
The print Function
Labels:
display,
echo,
examples,
output,
php,
print,
programming,
programming with php,
syntax
Some PHP Exercises
What does an echo function do?
What is the difference between using single quotes and double quotes in the echo function?
What is the difference between using single quotes and double quotes in the echo function?
Labels:
display,
dollar sign in php,
echo,
echo function,
exercises,
interview,
interview questions,
output,
print,
programming
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;
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’;
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
Smith
2.
Jones
3.
My name is Natasha
What is yours?
4.
My name is $name
5.
My name is John
Labels:
display,
dollar sign in php,
echo,
echo function,
output,
print,
programming,
programming with php
Subscribe to:
Posts (Atom)