04-28-2011, 12:06 AM
Now I m sharing about Some basic about Php:
- Never forgot use a "$" sign before any variable.
In Php:
-Echo statement is used to print something on screen link as:
<?php
echo "Hi, Every one";
?>
the out put of this line is-
Hi, Every one
- in Php we can also use control statements like as we used in c and c++:
If, if else, switch condition;
- in Php there is we can also use Loop condition as we used in c and c++;
for, while, do while;
but in Php we use an extra loop statement also "foreach" statement for fetching the data from an array like this:
foreach ($array as $value)
{
code to be executed;
}
for example if we have an array animal(cat, dog, cow) and we want to print then
<?php
$animal=array("cat","dog","cow");
foreach ($x as $value)
{
echo $value . "<br />";
}
?>
the out put will be:
cat
dog
cow
to be continued in up coming post..................
- Never forgot use a "$" sign before any variable.
In Php:
-Echo statement is used to print something on screen link as:
<?php
echo "Hi, Every one";
?>
the out put of this line is-
Hi, Every one
- in Php we can also use control statements like as we used in c and c++:
If, if else, switch condition;
- in Php there is we can also use Loop condition as we used in c and c++;
for, while, do while;
but in Php we use an extra loop statement also "foreach" statement for fetching the data from an array like this:
foreach ($array as $value)
{
code to be executed;
}
for example if we have an array animal(cat, dog, cow) and we want to print then
<?php
$animal=array("cat","dog","cow");
foreach ($x as $value)
{
echo $value . "<br />";
}
?>
the out put will be:
cat
dog
cow
to be continued in up coming post..................
