PHP is the language that we use to make the server generate dynamic output—output that is potentially different each time a browser requests a page.
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.
By default, servers look for PHP only in files that end with the .php extension. But a .php file can contain elements that aren’t part of your PHP script, and searching the entire file for potential scripts is confusing and resource-intensive. To solve this issue, all PHP scripts need to be contained with PHP delimiters. To begin a PHP script, you include the opening delimiter <?php and start coding. To finish, you simply add ? > to the end of the script. Anything outside of these delimiters will be treated as HTML or plain text.
Incorporating PHP Within HTML
By default, PHP documents end with the extension .php. When a web server encounters this extension in a requested file, it automatically passes it to the PHP processor. Of course, web servers are highly configurable, and some web developers choose to force files ending with .htm or .html to also get parsed by the PHP processor, usually because developers want to hide the fact that they are using PHP.
Your PHP program is responsible for passing back a clean file suitable for display in a web browser. At its very simplest, a PHP document will output only HTML. To prove this, you can take any normal HTML document such as an index.html file, save it as index.php, and it will display identically to the original.