PHP scripts are executed on the web server and the result is sent to the browser.
What is PHP
PHP stands for Hypertext Preprocessor. PHP is a powerful and widely-used open source server-side scripting language to write dynamically generated web pages. PHP scripts are executed on the server and the result is sent to the browser as plain HTML.
PHP can be integrated with the number of popular databases, including MySQL, PostgreSQL, Oracle, Sybase, Informix, and Microsoft SQL Server.
PHP can be embedded within a normal HTML web pages. That means inside your HTML documents you'll have PHP statements like this:
ExampleRun this code »
// Display greeting message
echo 'Hello World!';
What You Can Do with PHP
There are lot more things you can do with PHP.
- You can generate dynamic pages and files.
- You can create, open, read, write and close files on the server.
- You can collect data from a web form such as user information, email, credit card information and much more.
- You can send emails to the users of your website.
- You can send and receive cookies to track the visitor of your website.
- You can store, delete, and modify information in your database.
- You can restrict unauthorized access to your website.
- You can encrypt data for safe transmission over internet.
Advantages of PHP over Other Languages
If you're familiar with other server-side languages like ASP.NET or JSP, you might be wondering what makes PHP so special. There are several advantages why one should choose PHP over other languages. Here are some of them:
- Easy to learn: PHP is easy to learn and use. For beginner programmers who just started out in web development, PHP is often considered as the best and preferable choice of scripting language to learn.
- Open source: PHP is an open-source project — the language is developed and maintained by a worldwide community of developers who make its source code freely available to download and use. There are no costs associated with using PHP for individual or commercial projects, including future updates.
- Portability: PHP runs on various platforms such as Microsoft Windows, Linux, Mac OS, etc. and it is compatible with almost all servers used today such Apache, IIS, etc.
- Fast Performance: Scripts written in PHP usually execute faster than those written in other scripting languages like ASP.NET or JSP.
- Vast Community: Since PHP is supported by the worldwide community, finding help or documentation for PHP online is extremely easy.
Tip:Do you know some huge websites like Facebook, Yahoo, Flickr, and Wikipedia are built in PHP. Most of the major content management systems (CMS), such as WordPress, Drupal, Joomla and Magento are also built in PHP.