<?php
php stuff
?>
Ok, now that said, let's go to what this tutorial was written for. <?php
print("This is outputted to the webpage");
print "so is this!";
?>
You can also declare variables and then output them using the print
function: <?php
$hello = "hello"
print("$hello"); //this print the hello variable
print "$hello";
?>
That's really all there is to it. One thing is that it cannot be used in
a variable function, which I'll explain in a few minutes. <?php
$kool = "this is kool";
echo ("$kool prints \"kool\"");
echo "this does too!";
echo("hello");
echo "this prints \"hello\" too!";
?>
What's the difference between the two ? Well, one difference is that
echo() can take multiple expressions: <?php
echo "The first", "the second";
?>
Print cannot take multiple expressions. That is the main distinct
difference! <?php function foo()
{
echo "In foo()\n";
}
function bar($arg = '')
{
echo "In bar(); argument was '$arg'.\n";
}
$func = 'foo';
$func();
$func = 'bar';
$func('test');
?>
In the code above there are two simple functions are declared. Then their
names are assigned to the variable and both functions are executed using this
variable.
More Tutorials on roseindia.net for the topic PHP Introduction to PHP Echo and print Tutorial.If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.