PHP Basics #3 : How to get Started with PHP coding ?
How to get started with PHP Development ?
(Continue only if you Successfully Installed Apache, PHP and MySQL)
So now you know how to run a php file in browser and its time to get started in php development !!
Today we will talk about :
- How to write PHP codes
- Basic Syntax
- Echo Statement
1) How to write PHP codes ?
All codes here are PHP codes
?>
2) Basic Syntax of PHP
One more important thing in php to remember is that white spaces had no effect in php coding there is no indentation rules in php, which for me is quite good.
3) echo
The syntax of echo statement is
To print text in browser -> echo "Quotes if Text";
To print numbers in browser -> echo 1;
So create a new file named echo.php and inside the folder test and type the following inside the echo.php file..
echo "Hello World!!";
?>
If you open the file in browser the result will be..
Hello World!!
You can also do other things such as maths calculations..
echo 2+2;
?>
Result :
4
This was some basics of php codes and in next tutorials we will learn about PHP Variables and all..Till then do some experiments with your codes and try some more examples .. If you get stuck anywhere please comment