What is PHP and a little history behind it
PHP is a recursive acronym that stands for PHP: Hypertext Preprocessor. First version of PHP was released in 1994 by Rasmus Lerdorf. PHP is a open source server scripting language that is widely used. It can be used to manage dynamic content, databases, session tracking, build entire e-commerce sites, perform file handling operations, send emails, encrypt data, access and modify browser cookies. PHP is cross platform, which means that it can be easily developed and deployed on almost all major operating systems, like Windows, Linux, Mac OSX etc. Supports integration of a number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Infomix and Microsoft SQL Server. PHP supports a large number of protocols such as HTTP Basic, HTTP Digest, IMAP, FTP, POP3 and LDAP.
PHP can be easily embedded in HTML files.
What separates PHP from client-side JavaScript is that the code is executed on the server, and the generated HTML is then sent to the client. The client actually receives the results of the executed script, but he wouldn’t know what the code was.
There are multiple PHP frameworks, such as Symfony, CodeIgniter, Laravel, Joomla, WordPress that offer efficient and secure development processes and carry functionality for building all sorts of applications.
There are popular global websites that use PHP, such as Facebook, that has taken advantage of PHP’s capability to generate dynamic content. Also Wikipedia, Tumblr, Slack, MailChip, Etsy use PHP in the backend to maximize their workflow efficiency faster while speeding up the web request time and minimizing the program defects.
The last versions of PHP, especially the rise of PHP 7, introduced quick turnaround times by utilizing fast data processing features, excellent customization potential and efficient integration with a variety of custom management systems.
How to write PHP?
PHP code is written between these tags <?php ?>. First, you can start using PHP scripts and executing them in your terminal. To run PHP on your local machine, you'll need to have PHP installed.. Before we start check this tutorial on how to install and setup PHP on your local machine.
PHP scripts are defined using the extension .php . Let's do that. First create a new file named index.php and insert the code block below.
<?php
echo "My first PHP line of code";
?>
To execute the PHP script, you can use your terminal. Open your terminal and execute the following command:
php index.php
You should get the following output:
My first PHP line of code
Congratulations! You have successfully written your first PHP script and now you are ready to dive in other PHP features.