PHP Intro: PHP (Hypertext Preprocessor) is an open-source, widely-used, free, interpreted, object-oriented scripting language that allows the creation of dynamic and interactive websites by interacting with databases for web development and can easily embed into HTML.
PHP is a server-side scripting language, that requires a server to execute its code. Unlikely HTML, you cannot run its code in the browser, unless you have a PHP server to compile that code.
Embed into HTML
PHP pages contain HTML with embedded PHP code that does “something” and can easily provide the output in the browser to the user.
Let’s understand with an example.
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <?php echo "Hi, I'm a PHP script!"; ?> </body> </html>
When you check your browser, it will display “Hi, I’m a PHP script!“. You can check their official website here for more PHP intro.
The PHP code is always enclosed in a special type of start and end processing instructions <?php
and ?>
that allows you to jump into and out of “PHP mode.”
PHP files always have the extension .php
this helps the server identify the PHP file to execute.
To get a detailed overview of creating your first PHP test file. check this link here.