The PHP script is used to make a website dynamic.
The code is written within the defined PHP tags otherwise it would not execute.
1. PHP Tags
All PHP codes are specified within
<?php ?> tag.
<?php // code ?>
<html> <body> <?php echo "PHP CODE"; ?> </body> </html>
2. Include and require
With include and require statement, you can include existing files in your file.
Syntax – include
Syntax – require
Both statement use for including file but only difference is –
The require statement trigger FATAL ERROR if a file included more than once but the include statement doesn’t.
<?php include "config.php"; ?> <html> <body> <?php echo "PHP CODE"; ?> </body> </html>
Specify your PHP code between
<?php ?> tags in the webpage. You can use include and require statement to embed existing files.