Let’s see how a basic HTML page with PHP can be setup.
Below is a basic HTML page:
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>my first PHP page</title> </head> <body> <!-- our php codes here --> </body> </html>
PHP codes syntax is:
<?php // your php codes here ?>
So, now let’s write “Welcome to 9zap.com” using PHP.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title>my first PHP page</title> </head> <body> <?php echo "Welcome to 9zap.com"; ?> </body> </html>
echo command is use to print something.
All PHP instruction / lines must end with a semicolon (;)