PHP (stands for PHP Hypertext Preprocessor) is the backend, server-side scripting language, widely used for web development.
Most of its syntax is similar to C, so if anyone has basic knowledge of C or any other programming language can easily understand the syntax of PHP.
PHP code runs on the server and manages the databases, sessions, cookies, forms etc.
All popular platforms like Windows, Linux, UNIX and Mac and web browsers like Mozilla, Chrome, Internet Explorer, Safari etc, support PHP.
PHP is used to create dynamic contents of the web pages, send data to the browsers, receive form requests, evaluate them, create and destroy user sessions, store and retrieve user data by integrating the databases like MySQL and Oracle etc.
The PHP code is embedded into HTML or it can be written in a separate file which should be saved with a .php extension.
Learning PHP requires:
-
Basic knowledge and understanding of HTML, because it is used to create the front-end structure of the web page
-
Basic knowledge and understanding of CSS, because it is used to style the web pages
-
Basic knowledge of and understanding of JavaScript, because it is used to make web pages interactive
Why use PHP?
-
It is easy to learn
-
It is open-source language
-
It is Platform Independent
-
PHP is the Object-Oriented Language and supports OOP-features like Inheritance, Polymorphism, and Encapsulation
-
Most popular programming language for web development in the current era
-
Contains rich set of frameworks like Laravel, Symphony, CodeIgniter, Phalcon etc, which make development more easier
-
Can be used with large number of relational database management systems
-
PHP runs on almost all popular webservers like Apache, Tomcat and IIS
-
Most secured language to develop dynamic web pages because it has got a security layer to block viruses and threats
-
Most popular websites have used PHP like Facebook, Yahoo, Flickr, Tumblr, Wikipedia etc.
HP HelloWorld Script
<?php
echo "Hello, World";
?>
It will show just "Hello, World" in the browser.
###Tools for learning PHP###
1. XAMPP: Because PHP is server-side scripting language; it requires the server on which it will run. XAMPP is the full stack or package of tools which includes Apache (Server) to run PHP code, MySql (Database) to create the database management system, FTP (to transfer files to the browsers).
2. Notepad++: There are tons of free and paid IDEs (Integrated Development Environment) for PHP. Notepad++ is the best free text editor and support several languages like PHP, Java, C++ etc.
3. Web Browser: PHP is supported by all popular web browsers like Mozilla Firefox, Google Chrome, Internet Explorer and Safari. One of them can be used to see the results of the code. These web browsers are also integrated with the Notepad++; we can directly run the code from the Notepad++.