Such sites like
www.facebook.com, www.yahoo.com are also built in PHP. It can be easily embedded in HTML files, and HTML codes can also be written to a PHP file. The peculiarity of PHP and HTML is that PHP codes are executed on the server, while HTML codes are directly displayed in the browser. PHP codes are first executed on the server and then the result is returned to the browser. The only information a client or browser knows is - it is the result returned after the PHP script is executed on the server, not the actual PHP codes present in the PHP file. In addition, PHP files can support other client-side scripting languages such as CSS and JavaScript.
Syntax:
echo
" Welcome to GeeksforGeeks! "
;
?>
PHP Features: - Open Source:It is an open source programming language, so it is free to download.
- Simplicity:because PHP does not include libraries like C / C++, its structure is simple. It contains many predefined features to protect your data. PHP execution starts with (
- Efficiency:PHP 4.0 uses resource allocation mechanisms and object-oriented programming in addition to session management functions. This eliminates unnecessary memory allocation.
- Security:PHP supports many encryption features to protect data.
- Flexibility:it’s very flexible language because it can be embedded in HTML, CSS, JavaScript, XML and many other languages. Also, PHP code can run on any device like phone, tabs, laptops, etc.
- Object Oriented: Object Oriented Programming Featuresadded to PHP 4.0.
PHP advantages: - It is supported by all operating systems like Windows, Linux, Unix, etc. .
- It is integrated with other programming languages (HTML, CSS, JavaScript, etc.) and is database based.
- It is easy to connect to a database to store and retrieve data from the database. Several databases can also be integrated with PHP.
- It is the fastest programming language compared to other programming languages.
- PHP frameworks and tools are used to protect web applications from external attacks and security threats.
Disadvantages of PHP: - Since PHP is open source, its code is visible to all programmers. If there are any errors in the source code, their weaknesses can be explored by other programmers.
- It is not suitable for large applications because its maintenance is difficult.
- Error handling in PHP framework is not very good.