PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.You can nearly do anthing with in the server-side.
Things Needed To install and use PHP
- Web Server web server is needed to install and run php on your pc
- PHP install the latest version of PHP from the official website of PHP
- Database install a database like MySQL from here
Simple PHP Syntax
PHP script can be placed anywhere in the document and you must save the document with .php extension.
<html> <body> <p>This is the basic example of PHP</p> <?php echo "Simple Example of PHP"; ?> </body> </html>
All the PHP statements end with a semicolon (;).
PHP comments is used to easily read the codes, comments cannot be executed and cannot be read by the users.
<html> <body> <p>This is the basic example of PHP Comments</p> <?php // single line comment. /* Multiple line comment1 Multiple line comment2 Multiple line comment3 */ echo "Simple Example of PHP Comments"; ?> </body> </html>