Getting Started with PHP
Introduction
Let’s Get Started with PHP. In this tutorial, we will run a simple PHP application called Hello World. PHP is a server-side programming language used to enhance web pages.
PHP is an HTML-embedded scripting language. The PHP code can be embedded inside HTML code by enclosing it inside <?php and ?> tags. PHP code is executed on the server, unlike JavaScript.
Differences between PHP and JavaScript can be found here:
https://www.testingdocs.com/difference-between-php-and-javascript/
Download
You can download PHP from the below URL:
Detailed steps can be found here:
https://www.testingdocs.com/download-and-install-php/
Note that if you have installed XAMPP you already get PHP. XAMPP is the most popular PHP development environment. XAMPP is a completely free, easy-to-install Apache distribution containing MariaDB, and PHP. The XAMPP package has been set up to be incredibly easy to install and use.
https://www.testingdocs.com/xampp-download-and-install/
Hello World in PHP
<!DOCTYPE HTML> <html> <head> <title>PHP Example</title> </head> <body> <?php echo "Hello World!"; ?> </body> </html>
Run the PHP Program
Create a folder named FirstProgram inside the htdocs folder under the XAMPP install directory.
Create a text file inside the above folder and give a name. Example HelloWorld.php
Add the above code to the file and save it.
Open your favorite browser and visit the URL:
http://localhost/firstprogram/HelloWorld.php
Make sure you start the Apache server from the XAMPP control panel.
Hooray..! you have written and run your first PHP program.
Dependency Management
PHP dependency management tool is called Composer. The Composer will automatically manage the dependencies in the project. It takes care of the versioning and other things. Instructions to download and install Composer on Windows can be found here:
https://www.testingdocs.com/composer-download-on-windows/
Next Step
https://www.testingdocs.com/php-program-to-add-two-numbers/